#[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
impl VpnClient
pub fn set_loglevel(&self, level: LogLevel)
pub fn set_protocol(&self, protocol: &str) -> OpenconnectResult<()>
pub fn set_stats_handler(&self)
pub fn setup_tun_device( &self, vpnc_script: Option<String>, ifname: Option<String>, ) -> OpenconnectResult<()>
pub fn set_setup_tun_handler(&self)
pub fn set_report_os(&self, os: &str) -> OpenconnectResult<()>
pub fn setup_cmd_pipe(&self) -> OpenconnectResult<()>
pub fn reset_ssl(&self)
pub fn make_cstp_connection(&self) -> OpenconnectResult<()>
pub fn get_dlts_cipher(&self) -> Option<String>
pub fn get_peer_cert_hash(&self) -> String
pub fn disable_dtls(&self) -> OpenconnectResult<()>
pub fn set_http_proxy(&self, proxy: &str) -> OpenconnectResult<()>
pub fn parse_url(&self, url: &str) -> OpenconnectResult<()>
pub fn get_server_name(&self) -> Option<String>
pub fn get_server_url(&self) -> Option<String>
pub fn get_port(&self) -> i32
pub fn get_hostname(&self) -> Option<String>
pub fn set_client_cert(&self, cert: &str, sslkey: &str) -> OpenconnectResult<()>
pub fn set_mca_cert(&self, cert: &str, key: &str) -> OpenconnectResult<()>
pub fn get_info(&self) -> OpenconnectResult<Option<IpInfo>>
Trait Implementations§
Source§impl CmdPipe for VpnClient
impl CmdPipe for VpnClient
fn set_sock_block(&self, cmd_fd: i32)
fn send_command(&self, cmd: Command)
Source§impl Connectable for VpnClient
impl Connectable for VpnClient
Source§fn new(config: Config, callbacks: EventHandlers) -> OpenconnectResult<Arc<Self>>
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<()>
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<()>
fn run_loop(&self) -> OpenconnectResult<()>
Run main loop and block until the connection is closed
Source§fn disconnect(&self)
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