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§
Sourcefn id(&self) -> ProtocolId
fn id(&self) -> ProtocolId
Returns the unique identifier for the protocol this detector handles.
Sourcefn detect(&self, prefix: &[u8]) -> DetectResult
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".