Trait PacketModifier

Source
pub trait PacketModifier {
    // Required method
    fn new(_: Config) -> Self
       where Self: Sized;

    // Provided methods
    fn outgoing(&mut self, _: &[u8]) -> Option<Vec<u8>> { ... }
    fn incoming(&mut self, _: &[u8]) -> Option<Vec<u8>> { ... }
}
Expand description

Trait describing optional per-packet payload modification logic.

Required Methods§

Source

fn new(_: Config) -> Self
where Self: Sized,

Method that constructs a new packet modifier using the provided configuration.

Provided Methods§

Source

fn outgoing(&mut self, _: &[u8]) -> Option<Vec<u8>>

Method that is called for payload modification before a packet is send over a connection’s underlying socket.

The default implementation does not actually perform any kind of modification and leaves the payload to be send untouched.

Source

fn incoming(&mut self, _: &[u8]) -> Option<Vec<u8>>

Method that is called for payload modification purposes after a packet is received over a connection’s underlying socket.

The default implementation does not actually perform any kind of modification and returns leaves received payload untouched.

Trait Implementations§

Source§

impl Debug for dyn PacketModifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§