Struct VpnClient

Source
#[repr(C)]
pub struct VpnClient { /* private fields */ }
Expand description

VpnClient struct

This struct is the main entrypoint for interacting with the Openconnect C library (on top of openconnect-sys)

Implementations§

Source§

impl VpnClient

Source

pub fn set_loglevel(&self, level: LogLevel)

Source

pub fn set_protocol(&self, protocol: &str) -> OpenconnectResult<()>

Source

pub fn set_stats_handler(&self)

Source

pub fn setup_tun_device( &self, vpnc_script: Option<String>, ifname: Option<String>, ) -> OpenconnectResult<()>

Source

pub fn set_setup_tun_handler(&self)

Source

pub fn set_report_os(&self, os: &str) -> OpenconnectResult<()>

Source

pub fn setup_cmd_pipe(&self) -> OpenconnectResult<()>

Source

pub fn reset_ssl(&self)

Source

pub fn make_cstp_connection(&self) -> OpenconnectResult<()>

Source

pub fn get_dlts_cipher(&self) -> Option<String>

Source

pub fn get_peer_cert_hash(&self) -> String

Source

pub fn disable_dtls(&self) -> OpenconnectResult<()>

Source

pub fn set_http_proxy(&self, proxy: &str) -> OpenconnectResult<()>

Source

pub fn parse_url(&self, url: &str) -> OpenconnectResult<()>

Source

pub fn get_server_name(&self) -> Option<String>

Source

pub fn get_server_url(&self) -> Option<String>

Source

pub fn get_port(&self) -> i32

Source

pub fn get_hostname(&self) -> Option<String>

Source

pub fn set_client_cert(&self, cert: &str, sslkey: &str) -> OpenconnectResult<()>

Source

pub fn set_mca_cert(&self, cert: &str, key: &str) -> OpenconnectResult<()>

Source

pub fn get_info(&self) -> OpenconnectResult<Option<IpInfo>>

Trait Implementations§

Source§

impl CmdPipe for VpnClient

Source§

fn set_sock_block(&self, cmd_fd: i32)

Source§

fn send_command(&self, cmd: Command)

Source§

impl Connectable for VpnClient

Source§

fn new(config: Config, callbacks: EventHandlers) -> OpenconnectResult<Arc<Self>>

Create a new instance of VpnClient

config can be created using config::ConfigBuilder

callbacks can be created using events::EventHandlers

Connect to the VPN server and obtain a cookie

This function will not keep the connection, it will only connect and obtain a cookie. This function will not block the thread

The cookie can be used to connect to the VPN server later by passing it to another config::EntrypointBuilder

entrypoint can be created using config::EntrypointBuilder

Source§

fn init_connection(&self, entrypoint: Entrypoint) -> OpenconnectResult<()>

Initialize the connection to the VPN server, this function will not block the thread and only make a CSTP connection

entrypoint can be created using config::EntrypointBuilder

Source§

fn run_loop(&self) -> OpenconnectResult<()>

Run main loop and block until the connection is closed

Source§

fn disconnect(&self)

Gracefully stop the main loop

This function will send a cancel command to the main loop and wait for the main loop to stop

Source§

fn get_server_name(&self) -> Option<String>

Source§

fn get_status(&self) -> Status

Source§

impl Drop for VpnClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for VpnClient

Source§

impl Sync for VpnClient

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more