Skip to main content

Transport

Trait Transport 

Source
pub trait Transport: Send + Sync {
    // Required methods
    fn protocol(&self) -> CoverProtocol;
    fn send<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        packet: Packet,
        peer: &'life1 PeerInfo,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn recv<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Packet>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stats(&self) -> TransportStats;
    fn start_background_traffic<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop_background_traffic<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_bandwidth_limit<'life0, 'async_trait>(
        &'life0 mut self,
        bytes_per_sec: u64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Transport layer abstraction for sending/receiving packets

Required Methods§

Source

fn protocol(&self) -> CoverProtocol

Get the cover protocol being mimicked

Source

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

Send a packet to a peer

Source

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

Receive a packet (blocks until one is available)

Source

fn stats(&self) -> TransportStats

Get transport statistics

Source

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

Start background traffic generation (dummy packets, etc.)

Source

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

Stop background traffic generation

Source

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

Adjust bandwidth usage (for adaptive quality)

Implementors§