Trait ngrok::Tunnel

source ·
pub trait Tunnel: Stream<Item = Result<Conn, AcceptError>> + Accept<Conn = Conn, Error = AcceptError> + Unpin + Send + 'static {
    // Required methods
    fn id(&self) -> &str;
    fn forwards_to(&self) -> &str;
    fn metadata(&self) -> &str;
    fn close<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An ngrok tunnel.

ngrok Tunnels act like TCP listeners and can be used as a [futures::stream::TryStream] of Connections from endpoints created on the ngrok service.

Required Methods§

source

fn id(&self) -> &str

Returns a tunnel’s unique ID.

source

fn forwards_to(&self) -> &str

Returns a human-readable string presented in the ngrok dashboard and the Tunnels API. Use the HttpTunnelBuilder::forwards_to, TcpTunnelBuilder::forwards_to, etc. to set this value explicitly.

source

fn metadata(&self) -> &str

Returns the arbitrary metadata string for this tunnel.

source

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Close the tunnel.

This is an RPC call that must be .awaited. It is equivalent to calling Session::close_tunnel with this tunnel’s ID.

If the tunnel is dropped, a task will be spawned to close it asynchronously.

Implementors§