Skip to main content

TraversalMethod

Trait TraversalMethod 

Source
pub trait TraversalMethod: Send + Sync {
    // Required methods
    fn kind(&self) -> TraversalKind;
    fn attempt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerTarget,
    ) -> Pin<Box<dyn Future<Output = Result<MethodOutcome, MethodError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A single NAT-traversal technique. Implementors are small + single-purpose and MUST honour the deadline the strategy hands them (they are additionally wrapped in a hard timeout by the strategy, so a hung method can never block connect).

Required Methods§

Source

fn kind(&self) -> TraversalKind

Which technique this is (for ordering + observability).

Source

fn attempt<'life0, 'life1, 'async_trait>( &'life0 self, peer: &'life1 PeerTarget, ) -> Pin<Box<dyn Future<Output = Result<MethodOutcome, MethodError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempt to produce a reachable address for peer. Ok(outcome) means “try dialing this”; Err means this technique did not work (the strategy falls through to the next one).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§