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§
Sourcefn protocol(&self) -> TunnelProtocol
fn protocol(&self) -> TunnelProtocol
Get the protocol type for this tunnel
Sourcefn config(&self) -> &TunnelConfig
fn config(&self) -> &TunnelConfig
Get the current configuration
Sourcefn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TunnelState> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
Sourcefn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TunnelMetrics> + 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,
Get tunnel performance metrics
Sourcefn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 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,
Establish the tunnel connection
Sourcefn disconnect<'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,
Close the tunnel connection
Sourcefn is_active<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + 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,
Check if the tunnel is currently active and usable
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn maintain<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 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,
Perform periodic maintenance (keepalive, metrics update, etc.)
Sourcefn 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_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