Trait ockam_transport_tcp::PortalInterceptor

source ·
pub trait PortalInterceptor:
    'static
    + Send
    + Sync {
    // Required method
    fn intercept<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 mut Context,
        direction: Direction,
        buffer: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Portal Interceptor

Required Methods§

source

fn intercept<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 mut Context, direction: Direction, buffer: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

This method is called whenever a message is intercepted in either direction. The returned buffer can be of any size and will be sent to the original destination. The buffer will always be discarded after the call, and it’s up to the interceptor to properly preserve it when needed.

Implementors§