pub struct ConfigBuilder { /* private fields */ }
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
pub fn new() -> Self
pub fn vpncscript(&mut self, vpncscript: &str) -> &mut Self
Sourcepub fn loglevel(&mut self, loglevel: LogLevel) -> &mut Self
pub fn loglevel(&mut self, loglevel: LogLevel) -> &mut Self
Examples found in repository?
examples/password_server.rs (line 15)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 dotenvy::from_path(".env.local").unwrap();
11 env::set_var("OPENSSL_CONF", "/dev/null");
12
13 let protocol = get_anyconnect_protocol();
14
15 let config = ConfigBuilder::default().loglevel(LogLevel::Info).build()?;
16
17 let event_handlers = EventHandlers::default();
18
19 let client = VpnClient::new(config, event_handlers)?;
20
21 let entrypoint = EntrypointBuilder::new()
22 .server(&env::var("VPN_SERVER").unwrap())
23 .username(&env::var("VPN_USERNAME").unwrap())
24 .password(&env::var("VPN_PASSWORD").unwrap())
25 .protocol(protocol)
26 .enable_udp(true)
27 .accept_insecure_cert(true)
28 .build()?;
29
30 client.init_connection(entrypoint)?;
31 client.run_loop()?;
32
33 Ok(())
34}
pub fn http_proxy(&mut self, http_proxy: &str) -> &mut Self
Sourcepub fn build(&self) -> OpenconnectResult<Config>
pub fn build(&self) -> OpenconnectResult<Config>
Examples found in repository?
examples/password_server.rs (line 15)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10 dotenvy::from_path(".env.local").unwrap();
11 env::set_var("OPENSSL_CONF", "/dev/null");
12
13 let protocol = get_anyconnect_protocol();
14
15 let config = ConfigBuilder::default().loglevel(LogLevel::Info).build()?;
16
17 let event_handlers = EventHandlers::default();
18
19 let client = VpnClient::new(config, event_handlers)?;
20
21 let entrypoint = EntrypointBuilder::new()
22 .server(&env::var("VPN_SERVER").unwrap())
23 .username(&env::var("VPN_USERNAME").unwrap())
24 .password(&env::var("VPN_PASSWORD").unwrap())
25 .protocol(protocol)
26 .enable_udp(true)
27 .accept_insecure_cert(true)
28 .build()?;
29
30 client.init_connection(entrypoint)?;
31 client.run_loop()?;
32
33 Ok(())
34}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more