Expand description
flowscope — passive flow & session tracking for packet capture.
Cross-platform, runtime-free library for observing what’s
happening on the wire. Pair with any source of &[u8] frames:
netring (Linux AF_PACKET / AF_XDP), pcap files, tun-tap,
eBPF, embedded.
§What’s here
Core (always on):
PacketView/Timestamp— the abstract input.FlowExtractor— turn a frame into a flow descriptor.FlowTracker— bidirectional flow accounting + TCP state machine + idle/eviction policy. Hot-cache fast path on monoflow workloads.Reassembler— sync per-(flow, side) TCP byte stream hook. Optional per-side buffer cap withOverflowPolicy(sliding-window or drop-flow).SessionParser/DatagramParser— typed L7 message parsing per flow.FlowDriver— sync wrapper combining the tracker with a reassembler factory; optional anomaly emission viaFlowDriver::with_emit_anomalies.driver::Driver— typed flow-lifecycle driver; register one session/datagram slot per protocol for typed L7 messages. This replaced the per-parserFlowSessionDriver/FlowDatagramDriverin 0.20 (#99).
Built-in extractors and decap combinators (extractors feature):
extract::FiveTuple,extract::IpPair,extract::MacPairextract::StripVlan,extract::StripMpls,extract::InnerVxlan,extract::InnerGtpU,extract::InnerGre,extract::AutoDetectEncap,extract::FlowLabel
§Cargo features
Granular leaf flags compose into coarse umbrellas. Pick the smallest
that fits; --all-features (docs.rs) turns on everything including the
FoxIO-licensed ja4plus.
Umbrellas & tiers — correct, coarse groupings (issue #87):
| Feature | Pulls |
|---|---|
full | l7 + every license-clean capability (excludes FoxIO ja4plus) |
l7 | every license-clean wire parser (the three parsers-* tiers + tls-fingerprints) |
parsers-core | http tls dns icmp |
parsers-l2l3 | arp ndp lldp cdp dhcp (L2/L3 asset discovery) |
parsers-tier2 | the 19 Tier-2 parsers (ssh ntp ssdp tftp mdns netbios-ns ftp smtp wireguard modbus stun rdp snmp radius quic smb ldap kerberos dnp3) |
nsm | network-security monitoring: fingerprint + tls-fingerprints + analysis |
ml | ml-features + ml-features-nprint |
export | ipfix + ipfix-export + the emit* writers |
Protocol parsers (each behind its own feature):
| Feature | Module | What you get |
|---|---|---|
http | http | HTTP/1.x request/response parser |
tls | tls | TLS handshake observer (ClientHello/ServerHello/Alert) |
dns | dns | DNS-over-UDP/TCP parsers + query/response correlator |
icmp | icmp | ICMPv4/v6 decoder + inner-flow correlation |
arp | arp | ARP + correlate::NeighborTable binding tracker |
ndp | ndp | IPv6 Neighbor Discovery (ICMPv6 135/136) |
dhcp | dhcp | DHCP/BOOTP options + Fingerbank-style fingerprint |
lldp | lldp | LLDP (IEEE 802.1AB) L2 asset discovery |
cdp | cdp | Cisco Discovery Protocol |
ssh | ssh | SSH banner + KEXINIT + HASSH fingerprint |
ntp | ntp | NTP (UDP/123); monlist amplification signal |
ssdp | ssdp | SSDP/UPnP IoT discovery |
tftp | tftp | TFTP (UDP/69) device-config-theft visibility |
mdns | mdns | mDNS / DNS-SD service walker (pulls dns) |
netbios-ns | netbios_ns | NetBIOS Name Service (UDP/137) |
ftp | ftp | FTP control channel + AUTH-TLS upgrade |
smtp | smtp | SMTP + AUTH base64 decode + STARTTLS |
wireguard | wireguard | WireGuard handshake metadata |
modbus | modbus | Modbus/TCP (502) ICS visibility |
stun | stun | STUN (RFC 5389) WebRTC / NAT discovery |
rdp | rdp | RDP X.224 negotiation metadata |
snmp | snmp | SNMP v1/v2c (rusticata snmp-parser) |
radius | radius | RADIUS auth/accounting (rusticata radius-parser) |
quic | quic | QUIC Initial passive decrypt → SNI/ALPN |
smb | smb | SMB2/3 lateral-movement decode |
ldap | ldap | LDAP bind/search (rusticata ldap-parser) |
kerberos | kerberos | Kerberos AS/TGS/KRB-ERROR |
dnp3 | dnp3 | DNP3 (TCP/20000) OT/SCADA metadata |
Capabilities & output:
| Feature | Module | What you get |
|---|---|---|
asset | asset | Asset + LRU Inventory; self-sufficient (pulls its discovery parsers) |
analysis | analysis | FlowAnalyzer → risk / IOC enriched flow records |
tcp_fingerprint | tcp_fingerprint | p0f-style passive TCP/IP OS fingerprint |
fingerprint | detect::fingerprint | encrypted-flow behavioural fingerprint (not the JA4+ facade — see below) |
tls-fingerprints | tls | JA3 + JA4 TLS client fingerprints (royalty-free) |
ja4plus | tls | JA4S/JA4X server fingerprints (FoxIO License 1.1, off by default) |
ml-features / ml-features-nprint | ml_features / nprint | CICFlowMeter vector / nPrint bit matrix |
ipfix / ipfix-export | ipfix | IANA IE vocabulary / RFC 7011 binary encoder |
emit / emit-ndjson / emit-eve | emit | CSV+Zeek / NDJSON / Suricata EVE writers |
aggregate | aggregate | Histogram + Percentile (t-digest) |
file-hash | detect::file | streaming SHA-256/MD5 + MIME-class detection |
community-id | well_known | Corelight Community ID v1 flow hashing |
chrono | Timestamp | chrono::DateTime<Utc> interop |
pcap | pcap | pcap file source for offline replay |
serde | — | Serialize/Deserialize on every public type (locks wire vocabulary) |
Always-on modules (no feature gate):
| Module | What you get |
|---|---|
fingerprint | unified JA4+ facade — one import site for the whole family, grouped by license (distinct from the fingerprint-feature behavioural detector above) |
app_proto | identify h2 / h3 + DoT / DoQ / DoH over an encrypted transport from ALPN / SNI / port (no decryption) |
ip_fragment | IP fragment reassembly (RFC 791 key, RFC 5722 overlap-drop) — defeats fragmentation-based L4/L7 evasion |
Observability (zero-cost when off):
| Feature | What you get |
|---|---|
metrics | Prometheus / OpenTelemetry counters, gauges, histograms (see obs) |
tracing | Structured events on flow lifecycle + anomalies |
§Tokio integration
For async iteration over flow / session / datagram events, see
netring’s AsyncCapture::flow_stream
/ .session_stream / .datagram_stream. Those depend on this
crate’s traits. The sync analogue is the typed driver::Driver
with one session/datagram slot per protocol.
§Re-exporting flowscope types
Crates that re-export flowscope types (netring, sister crates,
internal forks) should write intra-doc links in the bare
[`FlowDriver`] form, not the explicit
[`FlowDriver`](flowscope::FlowDriver) form.
The explicit path duplicates what rustdoc already resolves through
the re-export and trips the redundant_explicit_links lint under
-D warnings. See recipes.md’s “Re-exporting flowscope types”
section for the worked example.
Re-exports§
pub use detector_kind::DetectorKind;pub use mac_addr::MacAddr;pub use parser_kind::ParserKind;pub use rx_metadata::ChecksumStatus;pub use rx_metadata::RssHashType;pub use rx_metadata::RxHash;pub use rx_metadata::RxMetadata;pub use rx_metadata::VlanProto;pub use rx_metadata::VlanTag;pub use anomaly::DetectorScore;trackerpub use anomaly::OwnedAnomaly;trackerpub use detect::registry::Detector;trackerpub use detect::registry::DetectorRegistry;trackerpub use segment_reassembler::SegmentBufferReassembler;reassemblerpub use icmp::DestUnreachableKind;icmppub use icmp::MtuSignalKind;icmppub use arp::ArpMessage;arppub use arp::ArpOp;arppub use ndp::NdpKind;ndppub use ndp::NdpMessage;ndppub use dhcp::DhcpMessage;dhcppub use dhcp::DhcpMessageType;dhcppub use dhcp::DhcpOp;dhcppub use lldp::ChassisId;lldppub use lldp::LldpMessage;lldppub use lldp::PortId;lldppub use lldp::SystemCapabilities;lldppub use cdp::CdpAddress;cdppub use cdp::CdpCapabilities;cdppub use cdp::CdpMessage;cdppub use ntp::NtpLeapIndicator;ntppub use ntp::NtpMessage;ntppub use ntp::NtpMode;ntppub use ntp::NtpTimestamp;ntppub use ssdp::SsdpKind;ssdppub use ssdp::SsdpMessage;ssdppub use tftp::TftpErrorCode;tftppub use tftp::TftpMessage;tftppub use tftp::TftpMode;tftppub use tftp::TftpOpcode;tftppub use mdns::MdnsParser;mdnspub use mdns::ServiceRecord;mdnspub use netbios_ns::NbnsMessage;netbios-nspub use netbios_ns::NbnsOpcode;netbios-nspub use netbios_ns::NbnsParser;netbios-nspub use ftp::FtpCommand;ftppub use ftp::FtpMessage;ftppub use ftp::FtpParser;ftppub use ftp::FtpReplyClass;ftppub use ftp::TransferKind;ftppub use smtp::SmtpCommand;smtppub use smtp::SmtpMessage;smtppub use smtp::SmtpParser;smtppub use wireguard::WireGuardKind;wireguardpub use wireguard::WireGuardMessage;wireguardpub use wireguard::WireGuardParser;wireguardpub use modbus::ModbusExceptionCode;modbuspub use modbus::ModbusFunction;modbuspub use modbus::ModbusMessage;modbuspub use modbus::ModbusParser;modbuspub use stun::StunClass;stunpub use stun::StunMessage;stunpub use stun::StunParser;stunpub use rdp::RdpFailureCode;rdppub use rdp::RdpMessage;rdppub use rdp::RdpParser;rdppub use rdp::RdpProtocols;rdppub use snmp::SnmpMessage;snmppub use snmp::SnmpParser;snmppub use snmp::SnmpPduKind;snmppub use snmp::SnmpVersion;snmppub use radius::RadiusCodeKind;radiuspub use radius::RadiusMessage;radiuspub use radius::RadiusParser;radiuspub use dnp3::DnpAppFunctionKind;dnp3pub use dnp3::DnpApplication;dnp3pub use dnp3::DnpInternalIndications;dnp3pub use dnp3::DnpLinkFunctionKind;dnp3pub use dnp3::DnpMessage;dnp3pub use dnp3::DnpParser;dnp3pub use asset::Asset;assetpub use asset::AssetCapabilities;assetpub use asset::AssetFingerprints;assetpub use asset::AssetRole;assetpub use asset::AssetSourceSet;assetpub use asset::Inventory;assetpub use analysis::AnalyzedFlow;analysispub use analysis::FlowAnalyzer;analysispub use analysis::L7Summary;analysispub use tcp_fingerprint::TcpDirection;tcp_fingerprintpub use tcp_fingerprint::TcpFingerprint;tcp_fingerprintpub use ipfix::FlowRecord;ipfixpub use ml_features::CicFlowFeatures;ml-featurespub use nprint::NPrintConfig;ml-features-nprintpub use nprint::NPrintMatrix;ml-features-nprintpub use nprint::NPrintRow;ml-features-nprintpub use kerberos::KERBEROS_PORT;kerberospub use kerberos::KerberosEtype;kerberospub use kerberos::KerberosMessage;kerberospub use kerberos::KerberosMessageKind;kerberospub use kerberos::KerberosTcpParser;kerberospub use kerberos::KerberosUdpParser;kerberospub use ldap::LDAP_PORT;ldappub use ldap::LdapAuthKind;ldappub use ldap::LdapMessage;ldappub use ldap::LdapOperation;ldappub use ldap::LdapParser;ldappub use smb::DceRpcInterfaceUuid;smbpub use smb::NtlmAuth;smbpub use smb::SMB_PORT;smbpub use smb::SmbCommand;smbpub use smb::SmbDialect;smbpub use smb::SmbMessage;smbpub use smb::SmbParser;smbpub use quic::QUIC_PORT;quicpub use quic::QuicInitial;quicpub use quic::QuicUdpParser;quicpub use quic::QuicVersion;quicpub use ssh::SshKexInit;sshpub use ssh::SshMessage;sshpub use ssh::SshParser;sshpub use anomaly_fields::AnomalyFields;pub use anomaly_fields::KeyFields;pub use dedup::Dedup;trackerpub use event::AnomalyKind;trackerpub use event::EndReason;trackerpub use event::EventMask;trackerpub use event::FlowEvent;trackerpub use event::FlowSide;trackerpub use event::FlowState;trackerpub use event::FlowStats;trackerpub use event::MemcapPolicy;trackerpub use event::OverflowPolicy;trackerpub use event::TcpOverlapPolicy;trackerpub use extractor::Extracted;pub use extractor::FlowExtractor;pub use extractor::L4Proto;pub use extractor::Orientation;pub use extractor::TcpFlags;pub use extractor::TcpInfo;pub use flow_driver::FlowDriver;reassemblerpub use history::HistoryString;trackerpub use reassembler::BufferedReassembler;reassemblerpub use reassembler::BufferedReassemblerFactory;reassemblerpub use reassembler::NoopReassembler;reassemblerpub use reassembler::NoopReassemblerFactory;reassemblerpub use reassembler::Reassembler;reassemblerpub use reassembler::ReassemblerFactory;reassemblerpub use session::AccumulatingSessionParser;sessionpub use session::BufferedFrameDrain;sessionpub use session::DatagramParser;sessionpub use session::DatagramParserFactory;sessionpub use session::FrameDrainError;sessionpub use session::PerDatagramParser;sessionpub use session::SessionParser;sessionpub use session::SessionParserFactory;sessionpub use tracker::FlowEntry;trackerpub use tracker::FlowEvents;trackerpub use tracker::FlowTracker;trackerpub use tracker::FlowTrackerConfig;trackerpub use tracker::FlowTrackerStats;tracker
Modules§
- aggregate
aggregate flowscope::aggregate— distribution / quantile primitives.- analysis
analysis flowscope::analysis— the opt-in composition layer that turns parser output into enriched, SIEM-ready flow records.- anomaly
tracker - Canonical owned anomaly value type for detector-shaped emission and retention.
- anomaly_
fields KeyFields+AnomalyFields— structured field access for emit writers (EVE, NDJSON, CSV, Zeek, custom).- app_
proto flowscope::app_proto— identify the application protocol riding an encrypted transport from passively-observable signals: ALPN, SNI, and the L4 port (issue #138).- arp
arp - ARP (Address Resolution Protocol) parser.
- asset
asset - Passive asset inventory — a unified
Assetrecord over every L2/L3 discovery parser flowscope ships. - cdp
cdp - CDP (Cisco Discovery Protocol) parser.
- community_
id community-id - Community ID v1 flow hashing — the cross-tool standard for joining flows across Zeek, Suricata, Security Onion, Arkime and friends.
- correlate
tracker flowscope::correlate— generic helpers for cross-flow correlation patterns.- dedup
tracker - Content-hash deduplication of packet views.
- detect
flowscope::detect— lightweight detection primitives.- detector_
kind DetectorKind— typed detector identity.- dhcp
dhcp - DHCP parser (RFC 2131 BOOTP + RFC 2132 options).
- dnp3
dnp3 - DNP3 application-layer metadata-only parser.
- dns
dns - Passive DNS parsing (UDP/53).
- driver
extractorsandreassemblerandsession flowscope::driver— the typedDriver<E>+SlotHandle<M, K>shape (plan 121).- emit
emit flowscope::emit— structured event sinks.- event
tracker - Events emitted by
crate::FlowTrackeras packets flow through it. - extract
extractors - Built-in flow extractors and decap combinators.
- extractor
FlowExtractortrait and its supporting types.- fingerprint
flowscope::fingerprint— one import site for the whole JA4+ fingerprint family (issue #136).- flow_
driver reassembler FlowDriver— sync wrapper that bundles aFlowTrackerwith aReassemblerFactoryand dispatches TCP segments to the right reassembler.- ftp
ftp - FTP — TCP/21 control channel parser.
- history
tracker - Compact lifecycle representation à la Zeek’s
conn.loghistory. - http
http - Passive HTTP/1.x observer.
- icmp
icmp - Passive ICMPv4 / ICMPv6 message parsing (plan 76).
- ip_
fragment flowscope::ip_fragment— IP fragment reassembly (issue #138).- ipfix
ipfix - IPFIX (RFC 7011 / RFC 7012) Information Element vocabulary.
- ja4l
ja4plus - JA4L / JA4LS latency fingerprint (“light distance”) — FoxIO.
- kerberos
kerberos - Kerberos (RFC 4120) passive metadata parser.
- layers
extractors flowscope::layers— per-packet layered field access.- ldap
ldap - LDAP (RFC 4511) passive metadata parser — TCP/389.
- lldp
lldp - LLDP parser (IEEE 802.1AB-2016, EtherType 0x88cc).
- mac_
addr MacAddr— strongly-typed 48-bit Ethernet MAC address.- mdns
mdns - mDNS — Multicast DNS (RFC 6762) parser + service-discovery helpers.
- ml_
features ml-features flowscope::ml_features— CICFlowMeter-compatible per-flow feature vector subset for ML pipelines.- modbus
modbus - Modbus/TCP — TCP/502 passive parser.
- ndp
ndp - IPv6 NDP (Neighbor Discovery Protocol) parser. RFC 4861.
- netbios_
ns netbios-ns - NetBIOS Name Service (NBNS / NBT-NS) — RFC 1002 §4.2 over UDP/137.
- nprint
ml-features-nprint flowscope::nprint— nPrint (CCS 2021) per-packet header-bit matrix for model-agnostic ML pipelines.- ntp
ntp - NTP / SNTP parser. RFC 5905.
- obs
tracker - Observability hooks —
metricscounters andtracingevents. - parser_
kind ParserKind— typed parser identity.- pcap
pcap - pcap file source for offline replay.
- prelude
use flowscope::prelude::*;— one import for the common types.- quic
quic - QUIC (RFC 9000) Initial-packet passive metadata parser.
- radius
radius - RADIUS — UDP/1812 (auth) + UDP/1813 (accounting).
- rdp
rdp - RDP — TCP/3389 X.224 Connection Request / Confirm parser.
- reassembler
reassembler - Sync TCP reassembly hooks.
- rx_
metadata RxMetadata— per-packet hardware-provided metadata from the NIC’s receive path.- segment_
reassembler reassembler SegmentBufferReassembler— TCP reassembler with out-of-order hole-fill.- session
session - Pluggable L7 message parsers.
- smb
smb - SMB (Server Message Block) v1 / v2 / v3 passive metadata parser — TCP/445.
- smtp
smtp - SMTP — TCP/25 + submission (TCP/587) parser.
- snmp
snmp - SNMP v1/v2c parser.
- ssdp
ssdp - SSDP (Simple Service Discovery Protocol) parser.
- ssh
ssh - SSH handshake parser + HASSH fingerprint.
- stun
stun - STUN — RFC 5389 / 8489 over UDP (typically 3478).
- tcp_
fingerprint tcp_fingerprint - p0f-style passive TCP/IP stack fingerprint.
- tcp_
state trackerand (test-helpers) - TCP state machine used internally by
crate::FlowTracker. - test_
helpers sessionand (test-helpers) - Parser stubs for downstream test crates. Gated by the
test-helpersfeature; not for production use. Parser stubs intended for downstream test crates that need aSessionParser/DatagramParserimpl but don’t care about the produced messages. - tftp
tftp - TFTP (Trivial File Transfer Protocol) parser.
- tls
tls - Passive TLS handshake observer.
- tracker
tracker FlowTracker— a hashtable of live flows with a TCP state machine and idle-timeout sweep.- well_
known flowscope::well_known— curated port → protocol label table.- wireguard
wireguard - WireGuard passive handshake / transport detection.
Structs§
- Error
- The unified flowscope error type.
- Error
Kind - Routing-and-context kind for an
Error. - Owned
Packet View - An owned
PacketView— frame bytes in aVec<u8>plus timestamp and per-packet hardware metadata. Useas_viewto get a borrowedPacketView<'_>. - Packet
View - What a
crate::FlowExtractoris given. - Timestamp
- Nanosecond-precision kernel timestamp.
Enums§
Traits§
- AsPacket
View - One-method trait letting any owned-packet type produce a
borrowed
PacketView. Combined withtrack(impl Into<PacketView<'_>>), it lets foreign packet types be passed straight totracker.track(&owned)/driver.track(&owned).
Type Aliases§
- Result
- Result alias used throughout flowscope.