Skip to main content

Module ip_packet

Module ip_packet 

Source
Expand description

§VCL IP Packet Parser

Full parsing of IPv4/IPv6 packets captured from the TUN interface. Extracts transport layer headers (TCP, UDP, ICMP) for routing decisions.

§Example

use vcl_protocol::ip_packet::{ParsedPacket, TransportProtocol};

// Minimal IPv4/TCP packet
let raw = vec![
    0x45, 0x00, 0x00, 0x28,
    0x00, 0x01, 0x00, 0x00,
    0x40, 0x06, 0x00, 0x00,
    192, 168, 1, 1,
    10, 0, 0, 1,
    0x00, 0x50, 0x1F, 0x90, // src=80, dst=8080
    0x00, 0x00, 0x00, 0x01,
    0x00, 0x00, 0x00, 0x01,
    0x50, 0x02, 0x20, 0x00,
    0x00, 0x00, 0x00, 0x00,
];

let packet = ParsedPacket::parse(raw).unwrap();
assert!(matches!(packet.transport, TransportProtocol::Tcp { .. }));

Structs§

ParsedPacket
A fully parsed IP packet with IP and transport layer information.

Enums§

IpVersion
IP version of a parsed packet.
TransportProtocol
Transport layer protocol extracted from an IP packet.