Skip to main content

TrafficProcess

Trait TrafficProcess 

Source
pub trait TrafficProcess: Send + Sync {
    type Codec;

    // Required methods
    fn initial_connect<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        source: &'life1 mut Transport,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn initial_framed_connect<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        source: &'life1 mut Framed<Transport, Self::Codec>,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn post_process_traffic<'life0, 'async_trait>(
        &'life0 mut self,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn pre_process_traffic<'life0, 'async_trait>(
        &'life0 mut self,
        data: BytesMut,
    ) -> Pin<Box<dyn Future<Output = BytesMut> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clone(&self) -> Box<dyn TrafficProcess<Codec = Self::Codec>>;
}
Expand description

A traffic processor trait, that applied to all streams. Processes all stream. If you need setup by each specific stream, use codecs instead

Required Associated Types§

Required Methods§

Source

fn initial_connect<'life0, 'life1, 'async_trait>( &'life0 mut self, source: &'life1 mut Transport, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The routine that defines if we can connect stream or not

Source

fn initial_framed_connect<'life0, 'life1, 'async_trait>( &'life0 mut self, source: &'life1 mut Framed<Transport, Self::Codec>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The routine that defines if we can connect stream or not, but when framed was setted up

Source

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

Process every traffic that is handled by server

Source

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

Process every traffic that is handled by server

Source

fn clone(&self) -> Box<dyn TrafficProcess<Codec = Self::Codec>>

Implementors§