Tunnel

Trait Tunnel 

Source
pub trait Tunnel: Send + Sync {
Show 15 methods // Required methods fn protocol(&self) -> TunnelProtocol; fn config(&self) -> &TunnelConfig; fn state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TunnelState> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn metrics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TunnelMetrics> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn connect<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn disconnect<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn is_active<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn encapsulate<'life0, 'life1, 'async_trait>( &'life0 self, ipv6_packet: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn decapsulate<'life0, 'life1, 'async_trait>( &'life0 self, ipv4_packet: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn send<'life0, 'life1, 'async_trait>( &'life0 mut self, packet: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn receive<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn maintain<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn local_ipv6_addr<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Ipv6Addr>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn local_ipv4_addr<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Ipv4Addr>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ping<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Duration>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Core trait for all tunneling protocol implementations

Required Methods§

Source

fn protocol(&self) -> TunnelProtocol

Get the protocol type for this tunnel

Source

fn config(&self) -> &TunnelConfig

Get the current configuration

Source

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

Get the current tunnel state

Source

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

Get tunnel performance metrics

Source

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

Establish the tunnel connection

Source

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

Close the tunnel connection

Source

fn is_active<'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 currently active and usable

Source

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

Encapsulate IPv6 packet for transmission over IPv4

Source

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

Decapsulate IPv4 packet to extract IPv6 content

Source

fn send<'life0, 'life1, 'async_trait>( &'life0 mut self, packet: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a packet through the tunnel

Source

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

Receive a packet from the tunnel

Source

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

Perform periodic maintenance (keepalive, metrics update, etc.)

Source

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

Get the IPv6 address assigned to this tunnel

Source

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

Get the IPv4 endpoint address for this tunnel

Source

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

Test tunnel connectivity with a ping

Implementors§