Crate openconnect_core
source ·Expand description
Openconnect core library
This library provides a safe Rust API for interacting with underlying Openconnect C library. The unsafe bindings are provided by the openconnect-sys crate.
Currently only password/oidc server has been supoorted
§Prerequisites
Read the openconnect-sys crate documentation for installing prerequisites including native system libraries and headers.
§Example
use openconnect_core::{
config::{ConfigBuilder, EntrypointBuilder, LogLevel},
events::EventHandlers,
protocols::get_anyconnect_protocol,
Connectable, VpnClient,
};
use std::env;
fn main() -> anyhow::Result<()> {
let protocol = get_anyconnect_protocol();
. let config = ConfigBuilder::default().loglevel(LogLevel::Info).build()?;
. let event_handlers = EventHandlers::default();
. let client = VpnClient::new(config, event_handlers)?;
. let entrypoint = EntrypointBuilder::new()
.server("vpn.example.com")
.username("your_username")
.password("your_password")
.protocol(protocol)
.enable_udp(true)
.accept_insecure_cert(true)
.build()?;
client.connect(entrypoint)?;
. Ok(())
}Modules§
Structs§
- VpnClient struct
Enums§
- Describe the connection status of the client
Traits§
- Trait for creating a new instance of VpnClient and connecting to the VPN server