Struct ConfigBuilder

Source
pub struct ConfigBuilder { /* private fields */ }

Implementations§

Source§

impl ConfigBuilder

Source

pub fn new() -> Self

Source

pub fn vpncscript(&mut self, vpncscript: &str) -> &mut Self

Source

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}
Source

pub fn http_proxy(&mut self, http_proxy: &str) -> &mut Self

Source

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§

Source§

impl Default for ConfigBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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