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§
Sourcefn protocol(&self) -> CoverProtocol
fn protocol(&self) -> CoverProtocol
Get the cover protocol being mimicked
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn stats(&self) -> TransportStats
fn stats(&self) -> TransportStats
Get transport statistics
Sourcefn 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 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.)