Pure MoonBit network packet capture (PCAP / PCAPNG) parser, stream reassembly, and multi-protocol analyzer library
moon add cghyyrrt/moonbit-pcapimport "cghyyrrt/moonbit-pcap/src/pcap"
import "cghyyrrt/moonbit-pcap/src/layers"
fn inspect_capture(bytes : Bytes) -> Int {
match @pcap.PcapReader::new(bytes) {
Some(reader) => reader.read_all().length()
None => 0
}
}| Package | Responsibility |
|---|---|
| src/binary | Safe binary I/O, cursors, queues, checksums, CRCs, and encoders |
| src/pcap | Classic PCAP headers, packets, writer, validator, and filters |
| src/pcapng | PCAPNG blocks, options, writer, and validator |
| src/layers | Link, network, transport, application, and industrial protocols |
| src/reassembly | TCP, UDP, IP-fragment, and bounded stream reassembly |
| src/analyzer | Statistics, sessions, rates, reports, and anomaly detection |
| src/exporter | JSON, CSV, HTML, terminal, and Markdown reports |
| src/cli | Command-line analysis pipeline |
| src/wasm | WebAssembly-facing integration functions |
moon fmt --check
moon check --deny-warn --target all
moon test --deny-warn
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/source-metrics.ps1
moon bench benchmarksmoon run cmd/main -- --helpPure MoonBit network packet capture (PCAP / PCAPNG) parser, stream reassembly, and multi-protocol analyzer library