pub struct MapTunnel { /* private fields */ }
Expand description
MAP tunnel implementation supporting both MAP-E and MAP-T
Implementations§
Source§impl MapTunnel
impl MapTunnel
Sourcepub fn new(config: TunnelConfig, protocol_variant: MapProtocol) -> Result<Self>
pub fn new(config: TunnelConfig, protocol_variant: MapProtocol) -> Result<Self>
Create a new MAP tunnel
Sourcepub fn add_map_rule(&mut self, rule: MapRule)
pub fn add_map_rule(&mut self, rule: MapRule)
Add a MAP rule to the configuration
Sourcepub fn calculate_ipv6_address(
&self,
ipv4_addr: Ipv4Addr,
rule: &MapRule,
) -> Result<Ipv6Addr>
pub fn calculate_ipv6_address( &self, ipv4_addr: Ipv4Addr, rule: &MapRule, ) -> Result<Ipv6Addr>
Calculate IPv6 address from IPv4 address and MAP rule
Sourcepub fn calculate_port_set(&self, psid: u16, rule: &MapRule) -> PortSet
pub fn calculate_port_set(&self, psid: u16, rule: &MapRule) -> PortSet
Calculate port set for a given PSID
Sourcepub fn extract_psid(&self, ipv4_addr: Ipv4Addr, rule: &MapRule) -> u16
pub fn extract_psid(&self, ipv4_addr: Ipv4Addr, rule: &MapRule) -> u16
Extract PSID from IPv4 address using MAP rule
Sourcepub async fn initialize_addresses(&mut self) -> Result<()>
pub async fn initialize_addresses(&mut self) -> Result<()>
Initialize local IPv4 address and generate ISATAP address (public for testing)
Sourcepub fn encapsulate_ipv4_in_ipv6(&self, ipv4_packet: &[u8]) -> Result<Vec<u8>>
pub fn encapsulate_ipv4_in_ipv6(&self, ipv4_packet: &[u8]) -> Result<Vec<u8>>
Encapsulate IPv4 packet in IPv6 for MAP-E
Sourcepub fn translate_ipv4_to_ipv6(&mut self, ipv4_packet: &[u8]) -> Result<Vec<u8>>
pub fn translate_ipv4_to_ipv6(&mut self, ipv4_packet: &[u8]) -> Result<Vec<u8>>
Translate IPv4 packet to IPv6 for MAP-T
Sourcepub fn is_port_allowed(&self, port: u16) -> bool
pub fn is_port_allowed(&self, port: u16) -> bool
Validate port against assigned port set
Trait Implementations§
Source§impl Tunnel for MapTunnel
impl Tunnel for MapTunnel
Source§fn protocol(&self) -> TunnelProtocol
fn protocol(&self) -> TunnelProtocol
Get the protocol type for this tunnel
Source§fn config(&self) -> &TunnelConfig
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,
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,
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,
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 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
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,
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 encapsulate<'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 encapsulate<'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,
Encapsulate IPv6 packet for transmission over IPv4
Source§fn decapsulate<'life0, 'life1, 'async_trait>(
&'life0 self,
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,
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,
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,
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,
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,
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
Auto Trait Implementations§
impl !Freeze for MapTunnel
impl RefUnwindSafe for MapTunnel
impl Send for MapTunnel
impl Sync for MapTunnel
impl Unpin for MapTunnel
impl UnwindSafe for MapTunnel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more