WireForge
A pure Rust network packet processing library — a complete replacement for libpnet.
Architecture
wireforge-io (Cross-platform raw socket I/O)
└── wireforge-packet (Packet enum, protocol dispatch)
└── wireforge-core (Zerocopy parsers, builders, types, checksums)
wireforge-app (DNS, DHCP, NTP, HTTP, pcap I/O)
└── wireforge-packet
Quick Start
// Parse an Ethernet frame
use EthernetPacket;
let eth = new.unwrap;
println!;
// Build a DNS query
use DnsPacketBuilder;
use ;
let query = query
.add_question
.build;
// Capture packets (cross-platform)
use ;
let mut rx = new?;
let eth = rx.recv?;
Protocol Coverage
| Layer | Protocols | Crate |
|---|---|---|
| L2 | Ethernet II, 802.1Q VLAN, ARP | wireforge-core |
| L3 | IPv4, IPv6 (+ ext headers), ICMP/ICMPv6/NDP, IGMP, GRE | wireforge-core |
| L4 | TCP (+ options), UDP | wireforge-core |
| App | DNS, DHCP, NTP, HTTP/1.1 | wireforge-app |
| I/O | pcap/pcapng read/write | wireforge-app |
Platform Support
| Platform | L2 Capture | L3 Capture | Backend |
|---|---|---|---|
| Linux | AF_PACKET | raw socket | socket2 + libc |
| macOS | BPF | raw socket | /dev/bpf + libc |
| Windows | NPcap | raw socket | wpcap.dll FFI + WinSock |
Migrating from libpnet
WireForge is a drop-in replacement for libpnet. See the Migration Guide for detailed API comparison and code examples.
Community
License
MIT