pub struct CanonicalKey {
pub addr_a: IpAddr,
pub addr_b: IpAddr,
pub port_a: u16,
pub port_b: u16,
pub protocol: TransportProtocol,
pub vlan_id: Option<u16>,
}Expand description
Bidirectional canonical conversation key.
Uses Wireshark-style canonical ordering: the smaller IP address is always
addr_a with its corresponding port as port_a. This ensures that both
directions of a conversation hash to the same key.
Fields§
§addr_a: IpAddrThe smaller IP address (or first if equal, then by port).
addr_b: IpAddrThe larger IP address.
port_a: u16Port corresponding to addr_a.
port_b: u16Port corresponding to addr_b.
protocol: TransportProtocolTransport protocol.
vlan_id: Option<u16>Optional VLAN ID for deinterlacing.
Implementations§
Source§impl CanonicalKey
impl CanonicalKey
Sourcepub fn new(
src_ip: IpAddr,
dst_ip: IpAddr,
src_port: u16,
dst_port: u16,
protocol: TransportProtocol,
vlan_id: Option<u16>,
) -> (Self, FlowDirection)
pub fn new( src_ip: IpAddr, dst_ip: IpAddr, src_port: u16, dst_port: u16, protocol: TransportProtocol, vlan_id: Option<u16>, ) -> (Self, FlowDirection)
Create a new canonical key with deterministic ordering.
Returns the key and the direction of the original packet relative to the canonical ordering.
Trait Implementations§
Source§impl Clone for CanonicalKey
impl Clone for CanonicalKey
Source§fn clone(&self) -> CanonicalKey
fn clone(&self) -> CanonicalKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CanonicalKey
impl Debug for CanonicalKey
Source§impl Display for CanonicalKey
impl Display for CanonicalKey
Source§impl Hash for CanonicalKey
impl Hash for CanonicalKey
Source§impl PartialEq for CanonicalKey
impl PartialEq for CanonicalKey
impl Eq for CanonicalKey
impl StructuralPartialEq for CanonicalKey
Auto Trait Implementations§
impl Freeze for CanonicalKey
impl RefUnwindSafe for CanonicalKey
impl Send for CanonicalKey
impl Sync for CanonicalKey
impl Unpin for CanonicalKey
impl UnsafeUnpin for CanonicalKey
impl UnwindSafe for CanonicalKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more