pub trait Filter: Send + Sync {
// Provided methods
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut ReadContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut WriteContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Trait for routing and manipulating packets.
An implementation of Filter
provides a read
and a write
method. Both
methods are invoked by the proxy when it consults the filter chain - their
arguments contain information about the packet being processed.
read
is invoked when a packet is received on the local downstream port and is to be sent to an upstream endpoint.write
is invoked in the opposite direction when a packet is received from an upstream endpoint and is to be sent to a downstream client.
Metrics
-
filter_read_duration_seconds
The duration it took for afilter
’sread
implementation to execute.- Labels
filter
The name of the filter being executed.
- Labels
-
filter_write_duration_seconds
The duration it took for afilter
’swrite
implementation to execute.- Labels
filter
The name of the filter being executed.
- Labels
Provided Methods§
sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut ReadContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut ReadContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Filter::read
is invoked when the proxy receives data from a
downstream connection on the listening port.
This function should return an Some
if the packet processing should
proceed. If the packet should be rejected, it will return None
instead. By default, the context passes through unchanged.
sourcefn write<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut WriteContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 mut WriteContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Filter::write
is invoked when the proxy is about to send data to a
downstream connection via the listening port after receiving it via one
of the upstream Endpoints.
This function should return an Some
if the packet processing should
proceed. If the packet should be rejected, it will return None