Trait ngrok::session::Connector

source ·
pub trait Connector: Sync + Send + 'static {
    // Required method
    fn connect<'life0, 'async_trait>(
        &'life0 self,
        host: String,
        port: u16,
        tls_config: Arc<ClientConfig>,
        err: Option<AcceptError>
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn IoStream>, ConnectError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for establishing the connection to the ngrok server.

Required Methods§

source

fn connect<'life0, 'async_trait>( &'life0 self, host: String, port: u16, tls_config: Arc<ClientConfig>, err: Option<AcceptError> ) -> Pin<Box<dyn Future<Output = Result<Box<dyn IoStream>, ConnectError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The function used to establish the connection to the ngrok server.

This is effectively async |addr, tls_config, err| -> Result<IoStream>.

If it is being called due to a disconnect, the AcceptError argument will be populated.

If it returns Err(ConnectError::Canceled), reconnecting will be canceled and the session will be terminated. Note that this error will never be returned from the default_connect function.

Implementors§

source§

impl<F, U> Connector for F
where F: Fn(String, u16, Arc<ClientConfig>, Option<AcceptError>) -> U + Send + Sync + 'static, U: Future<Output = Result<Box<dyn IoStream>, ConnectError>> + Send,