Skip to main content

CaptureSource

Trait CaptureSource 

Source
pub trait CaptureSource {
    type IO: AsyncRead + AsyncWrite + Unpin + Send + 'static;

    // Required method
    fn accept(
        &mut self,
    ) -> Pin<Box<dyn Future<Output = Result<IncomingConnection<Self::IO>>> + Send + '_>>;

    // Provided method
    fn listen_addrs(&self) -> Vec<SocketAddr> { ... }
}
Expand description

Trait for capturing traffic. This abstracts away the difference between a simple TCP Listener, a Transparent Proxy (TPROXY), or a TUN interface with a user-space stack.

Required Associated Types§

Source

type IO: AsyncRead + AsyncWrite + Unpin + Send + 'static

Required Methods§

Source

fn accept( &mut self, ) -> Pin<Box<dyn Future<Output = Result<IncomingConnection<Self::IO>>> + Send + '_>>

Accept the next connection from the source

Provided Methods§

Source

fn listen_addrs(&self) -> Vec<SocketAddr>

Returns the addresses this source is listening on (for loop detection)

Implementors§