Skip to main content

ProtocolDetector

Trait ProtocolDetector 

Source
pub trait ProtocolDetector: Send + Sync {
    // Required methods
    fn id(&self) -> ProtocolId;
    fn detect(&self, prefix: &[u8]) -> DetectResult;
}
Expand description

A trait for protocol detectors that can identify a protocol from the initial bytes of a stream.

Required Methods§

Source

fn id(&self) -> ProtocolId

Returns the unique identifier for the protocol this detector handles.

Source

fn detect(&self, prefix: &[u8]) -> DetectResult

Attempts to detect the protocol from the given byte prefix.

§Arguments
  • prefix - The bytes read from the start of the stream so far.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§