Packet Strata
A high-performance packet parsing library and PCAP reader for Rust.
⚠️ Disclaimer
This library is under active development. Breaking changes may occur between versions as the API evolves and stabilizes.
If you're using or experimenting with this library and encounter bugs or develop interesting features, please consider opening a pull request at https://github.com/awgn/packet-strata
Workspace Structure
This repository is organized as a Cargo workspace containing:
-
packet-strata-lib/- Core packet parsing library- Zero-copy packet parsing
- Support for multiple protocols (Ethernet, IPv4/IPv6, TCP, UDP, tunnels, etc.)
- Iterator-based and full-packet parsing modes
-
pcap-reader/- Command-line PCAP file analyzer- Reads PCAP and PCAPNG files
- Provides detailed packet statistics
- High-performance packet processing
Building
Build the library (default):
Build the entire workspace (library + pcap-reader):
Build only the library:
Build only the pcap-reader:
Usage
Using the Library
Add to your Cargo.toml:
[]
= "0.1"
Note: When adding packet-strata as a dependency, only the library will be built. The pcap-reader binary is excluded from default builds and won't be compiled unless explicitly requested with cargo build --workspace or cargo build -p pcap-reader.
Using the PCAP Reader
# Basic usage
# With statistics
# Dump packet contents
# Use full packet parsing (instead of iterator mode)
Or after building:
Features
Supported Protocols
Link Layer:
- Ethernet
- Linux Cooked Capture (SLL/SLLv2)
- Null/Loopback
Network Layer:
- IPv4
- IPv6
- ARP
- MPLS
Transport Layer:
- TCP
- UDP
- SCTP
- ICMP/ICMPv6
Tunnel Protocols:
- VXLAN
- Geneve
- GRE/NVGRE
- MPLS
- Teredo
- GTPv1/GTPv2
- L2TPv2/L2TPv3
- PBB
- STT
- PPTP
- IP-in-IP (IPIP, SIT, IP4in6, IP6Tnl)
License
MIT
Author
Nicola Bonelli nicola.bonelli@larthia.com