pub enum PacketDirection {
Upwards,
Downwards,
}Expand description
Represents the direction of a packet in a flow.
Direction is determined from the perspective of the client-server model:
Upwards: From client to server (request/query/initiator)Downwards: From server to client (response/reply)
For stateless analysis (mid-connection packets), the first packet seen
is assumed to be from the initiator and therefore Upwards.
Variants§
Implementations§
Source§impl PacketDirection
impl PacketDirection
Sourcepub fn infer(pkt: &Packet<'_>) -> PacketDirection
pub fn infer(pkt: &Packet<'_>) -> PacketDirection
Infers the direction of a packet based on transport layer information.
This method determines if a packet is Upwards (Client -> Server) or Downwards (Server -> Client) using:
- TCP: Analysis of SYN/SYN-ACK flags and well-known ports.
- UDP: Well-known ports (DNS, DHCP, NTP) and lightweight payload inspection (DPI Lite).
- ICMP: Message types (e.g., Echo Request vs Echo Reply).
If the direction cannot be definitively determined, it defaults to Upwards.
Trait Implementations§
Source§impl Clone for PacketDirection
impl Clone for PacketDirection
Source§fn clone(&self) -> PacketDirection
fn clone(&self) -> PacketDirection
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 PacketDirection
impl Debug for PacketDirection
Source§impl Default for PacketDirection
impl Default for PacketDirection
Source§fn default() -> PacketDirection
fn default() -> PacketDirection
Returns the “default value” for a type. Read more
Source§impl Display for PacketDirection
impl Display for PacketDirection
Source§impl PartialEq for PacketDirection
impl PartialEq for PacketDirection
impl Copy for PacketDirection
impl Eq for PacketDirection
impl StructuralPartialEq for PacketDirection
Auto Trait Implementations§
impl Freeze for PacketDirection
impl RefUnwindSafe for PacketDirection
impl Send for PacketDirection
impl Sync for PacketDirection
impl Unpin for PacketDirection
impl UnwindSafe for PacketDirection
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