Skip to main content

Tunnel

Trait Tunnel 

pub trait Tunnel: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn start<'life0, 'life1, 'async_trait>(
        &'life0 self,
        local_host: &'life1 str,
        local_port: u16,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn public_url(&self) -> Option<String>;

    // Provided method
    fn publish_tcp_services<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _services: &'life1 [TcpService],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedTcpService>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Human-readable model_provider name (e.g. “cloudflare”, “tailscale”)

Source

fn start<'life0, 'life1, 'async_trait>( &'life0 self, local_host: &'life1 str, local_port: u16, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start the tunnel, exposing local_host:local_port externally. Returns the public URL on success.

Source

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

Stop the tunnel, ending the processes it started and withdrawing what it published. The gateway calls this when it shuts down.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the tunnel is still alive.

Source

fn public_url(&self) -> Option<String>

Return the public URL if the tunnel is running.

Provided Methods§

Source

fn publish_tcp_services<'life0, 'life1, 'async_trait>( &'life0 self, _services: &'life1 [TcpService], ) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedTcpService>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publish daemon listeners that terminate their own TLS as raw TCP passthrough, after start. Returns only the services actually published. Providers without raw TCP passthrough publish nothing, which keeps those listeners at their configured bind.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§