[package]
edition = "2024"
rust-version = "1.95"
name = "netring"
version = "0.22.0"
authors = ["Marc Pardo <p13marc@gmail.com>"]
build = false
exclude = [
"CLAUDE.md",
"SPEC.md",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "High-performance zero-copy packet I/O for Linux (AF_PACKET TPACKET_V3 + AF_XDP)"
homepage = "https://github.com/p13marc/netring"
documentation = "https://docs.rs/netring"
readme = "README.md"
keywords = [
"packet",
"capture",
"af_packet",
"af_xdp",
"zero-copy",
]
categories = [
"network-programming",
"os::linux-apis",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/p13marc/netring"
resolver = "2"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
"--cfg",
"docsrs",
]
[features]
af-xdp = []
all-parsers = [
"http",
"dns",
"tls",
"icmp",
]
bench-zero-alloc = [
"dep:dhat",
"flow",
"tokio",
"parse",
]
channel = ["dep:crossbeam-channel"]
default = []
dns = [
"flow",
"flowscope/dns",
]
emit = [
"flow",
"flowscope/emit",
]
eve-sink = [
"emit",
"dep:serde_json",
"flowscope/emit-eve",
]
file-hash = ["flowscope/file-hash"]
flow = [
"parse",
"flowscope/tracker",
"flowscope/reassembler",
"flowscope/session",
"dep:bytes",
"dep:ahash",
]
http = [
"flow",
"flowscope/http",
]
icmp = [
"flow",
"flowscope/icmp",
]
integration-tests = []
metrics = ["dep:metrics"]
monitor = [
"tokio",
"channel",
"flow",
"parse",
"metrics",
"http",
"dns",
"tls",
"icmp",
"emit",
"serde",
]
monitor-quickstart = [
"tokio",
"channel",
"flow",
"parse",
"pcap",
"metrics",
"http",
"dns",
"tls",
"icmp",
"emit",
"eve-sink",
"file-hash",
"serde",
]
nightly = []
parse = [
"dep:etherparse",
"flowscope/extractors",
]
pcap = ["dep:pcap-file"]
serde = [
"dep:serde",
"dep:serde_json",
"flowscope/serde",
]
tls = [
"flow",
"flowscope/tls",
]
tokio = [
"dep:tokio",
"dep:tokio-stream",
"dep:futures-core",
]
xdp-loader = [
"af-xdp",
"dep:aya",
]
[lib]
name = "netring"
path = "src/lib.rs"
[[example]]
name = "active_flows_snapshot"
path = "examples/flow/active_flows_snapshot.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "async_bridge"
path = "examples/async_basics/bridge.rs"
required-features = ["tokio"]
[[example]]
name = "async_capture"
path = "examples/async_basics/capture.rs"
required-features = ["tokio"]
[[example]]
name = "async_fanout_workers"
path = "examples/scaling/async_fanout_workers.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "async_filter"
path = "examples/filter/async_filter.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "async_flow_channel"
path = "examples/flow/channel.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_conversations"
path = "examples/flow/conversations.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_filter"
path = "examples/flow/filter.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_history"
path = "examples/flow/history.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_idle_per_key"
path = "examples/flow/idle_per_key.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_keys"
path = "examples/flow/keys.rs"
required-features = [
"tokio",
"parse",
]
[[example]]
name = "async_flow_summary"
path = "examples/flow/summary.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_flow_with_tap"
path = "examples/flow/with_tap.rs"
required-features = [
"tokio",
"flow",
"parse",
"pcap",
]
[[example]]
name = "async_inject"
path = "examples/async_basics/inject.rs"
required-features = ["tokio"]
[[example]]
name = "async_lo_dedup"
path = "examples/async_basics/lo_dedup.rs"
required-features = ["tokio"]
[[example]]
name = "async_metrics"
path = "examples/async_basics/metrics.rs"
required-features = [
"tokio",
"metrics",
]
[[example]]
name = "async_multi_interface"
path = "examples/scaling/async_multi_interface.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "async_on_tick"
path = "examples/l7/on_tick.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "async_pcap_replay"
path = "examples/pcap/replay.rs"
required-features = [
"tokio",
"flow",
"parse",
"pcap",
]
[[example]]
name = "async_pcap_sessions"
path = "examples/pcap/sessions.rs"
required-features = [
"tokio",
"flow",
"parse",
"pcap",
]
[[example]]
name = "async_pipeline"
path = "examples/async_basics/pipeline.rs"
required-features = ["tokio"]
[[example]]
name = "async_signal"
path = "examples/async_basics/signal.rs"
required-features = ["tokio"]
[[example]]
name = "async_stats_monitor"
path = "examples/async_basics/stats_monitor.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "async_stream"
path = "examples/async_basics/stream.rs"
required-features = ["tokio"]
[[example]]
name = "async_streamext"
path = "examples/async_basics/streamext.rs"
required-features = ["tokio"]
[[example]]
name = "async_xdp"
path = "examples/xdp/async_xdp.rs"
required-features = [
"tokio",
"af-xdp",
]
[[example]]
name = "async_xdp_busy_poll"
path = "examples/xdp/async_xdp_busy_poll.rs"
required-features = [
"tokio",
"af-xdp",
]
[[example]]
name = "async_xdp_custom_program"
path = "examples/xdp/async_xdp_custom_program.rs"
required-features = [
"tokio",
"af-xdp",
"xdp-loader",
]
[[example]]
name = "async_xdp_self_loaded"
path = "examples/xdp/async_xdp_self_loaded.rs"
required-features = [
"tokio",
"af-xdp",
"xdp-loader",
]
[[example]]
name = "batch_processing"
path = "examples/basic/batch_processing.rs"
[[example]]
name = "bpf_filter"
path = "examples/filter/bpf_filter.rs"
[[example]]
name = "bridge"
path = "examples/basic/bridge.rs"
[[example]]
name = "capture"
path = "examples/basic/capture.rs"
[[example]]
name = "channel_consumer"
path = "examples/basic/channel_consumer.rs"
required-features = ["channel"]
[[example]]
name = "dns_lookups"
path = "examples/l7/dns_lookups.rs"
required-features = [
"tokio",
"dns",
]
[[example]]
name = "dns_query_burst"
path = "examples/anomaly/dns_query_burst.rs"
required-features = [
"tokio",
"dns",
]
[[example]]
name = "dns_resolved_no_connection"
path = "examples/anomaly/dns_resolved_no_connection.rs"
required-features = [
"tokio",
"dns",
]
[[example]]
name = "dpi"
path = "examples/basic/dpi.rs"
[[example]]
name = "ebpf_filter"
path = "examples/filter/ebpf_filter.rs"
[[example]]
name = "ewma_rate"
path = "examples/flow/ewma_rate.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "fanout"
path = "examples/scaling/fanout.rs"
[[example]]
name = "http_session"
path = "examples/l7/http_session.rs"
required-features = [
"tokio",
"http",
]
[[example]]
name = "inject"
path = "examples/basic/inject.rs"
[[example]]
name = "low_latency"
path = "examples/basic/low_latency.rs"
[[example]]
name = "monitor_async_handler"
path = "examples/monitor/async_handler.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_basic"
path = "examples/monitor/basic.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_beacon_detector"
path = "examples/monitor/beacon_detector.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_detector_macro"
path = "examples/monitor/detector_macro.rs"
required-features = [
"tokio",
"flow",
"http",
"dns",
]
[[example]]
name = "monitor_dga_query"
path = "examples/monitor/dga_query.rs"
required-features = [
"tokio",
"flow",
"dns",
]
[[example]]
name = "monitor_ech_adoption"
path = "examples/monitor/ech_adoption.rs"
required-features = [
"tokio",
"flow",
"tls",
]
[[example]]
name = "monitor_eve_to_filebeat"
path = "examples/monitor/eve_to_filebeat.rs"
required-features = [
"tokio",
"flow",
"eve-sink",
]
[[example]]
name = "monitor_file_hash_dfir"
path = "examples/monitor/file_hash_dfir.rs"
required-features = [
"tokio",
"flow",
"http",
"file-hash",
]
[[example]]
name = "monitor_label_table"
path = "examples/monitor/label_table.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_layered_sinks"
path = "examples/monitor/layered_sinks.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_metrics_export"
path = "examples/monitor/metrics_export.rs"
required-features = [
"tokio",
"flow",
"metrics",
]
[[example]]
name = "monitor_multi_thread_default"
path = "examples/monitor/multi_thread_default.rs"
required-features = [
"tokio",
"flow",
"channel",
]
[[example]]
name = "monitor_net_diagnostic"
path = "examples/monitor/net_diagnostic.rs"
required-features = [
"tokio",
"flow",
"icmp",
]
[[example]]
name = "monitor_pcap_replay"
path = "examples/monitor/pcap_replay.rs"
required-features = [
"tokio",
"flow",
"pcap",
]
[[example]]
name = "monitor_port_scan"
path = "examples/monitor/port_scan.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_report_stream"
path = "examples/monitor/report_stream.rs"
required-features = [
"tokio",
"flow",
"serde",
]
[[example]]
name = "monitor_sharded_runner"
path = "examples/monitor/sharded_runner.rs"
required-features = [
"tokio",
"flow",
]
[[example]]
name = "monitor_stream_consumer"
path = "examples/monitor/stream_consumer.rs"
required-features = [
"tokio",
"flow",
"http",
]
[[example]]
name = "multi_protocol_monitor"
path = "examples/l7/multi_protocol_monitor.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "pcap_write"
path = "examples/basic/pcap_write.rs"
required-features = ["pcap"]
[[example]]
name = "stats_monitor"
path = "examples/basic/stats_monitor.rs"
[[example]]
name = "synthetic_traffic"
path = "examples/util/synthetic_traffic.rs"
required-features = ["tokio"]
[[example]]
name = "top_n_flows"
path = "examples/flow/top_n_flows.rs"
required-features = [
"tokio",
"flow",
"parse",
]
[[example]]
name = "xdp_send"
path = "examples/xdp/xdp_send.rs"
required-features = ["af-xdp"]
[[example]]
name = "zeek_export"
path = "examples/flow/zeek_export.rs"
required-features = [
"tokio",
"flow",
"parse",
"emit",
]
[[test]]
name = "async_capture"
path = "tests/async_capture.rs"
[[test]]
name = "async_handler"
path = "tests/async_handler.rs"
[[test]]
name = "async_pcap_source"
path = "tests/async_pcap_source.rs"
[[test]]
name = "block_timeout"
path = "tests/block_timeout.rs"
[[test]]
name = "bpf_builder_proptest"
path = "tests/bpf_builder_proptest.rs"
[[test]]
name = "bpf_filter_lifecycle"
path = "tests/bpf_filter_lifecycle.rs"
[[test]]
name = "bpf_humanize"
path = "tests/bpf_humanize.rs"
[[test]]
name = "bridge"
path = "tests/bridge.rs"
[[test]]
name = "build_error_counter_not_registered"
path = "tests/build_error_counter_not_registered.rs"
[[test]]
name = "build_validation_handler_protocol"
path = "tests/build_validation_handler_protocol.rs"
[[test]]
name = "channel_capture"
path = "tests/channel_capture.rs"
[[test]]
name = "ctx_threading"
path = "tests/ctx_threading.rs"
[[test]]
name = "dedup_lo"
path = "tests/dedup_lo.rs"
[[test]]
name = "dedup_stress"
path = "tests/dedup_stress.rs"
[[test]]
name = "detector_macro_integration"
path = "tests/detector_macro_integration.rs"
[[test]]
name = "eintr"
path = "tests/eintr.rs"
[[test]]
name = "error_conditions"
path = "tests/error_conditions.rs"
[[test]]
name = "fanout"
path = "tests/fanout.rs"
[[test]]
name = "flow_packet_flat"
path = "tests/flow_packet_flat.rs"
[[test]]
name = "flow_state_mut"
path = "tests/flow_state_mut.rs"
[[test]]
name = "flow_stream_config"
path = "tests/flow_stream_config.rs"
[[test]]
name = "flowscope_03_passthrough"
path = "tests/flowscope_03_passthrough.rs"
[[test]]
name = "helpers"
path = "tests/helpers.rs"
[[test]]
name = "injector"
path = "tests/injector.rs"
[[test]]
name = "layer_chain"
path = "tests/layer_chain.rs"
[[test]]
name = "layer_spec"
path = "tests/layer_spec.rs"
[[test]]
name = "loopback_capture"
path = "tests/loopback_capture.rs"
[[test]]
name = "monitor_dispatch_synthetic"
path = "tests/monitor_dispatch_synthetic.rs"
[[test]]
name = "monitor_drain_timeout"
path = "tests/monitor_drain_timeout.rs"
[[test]]
name = "monitor_layer_chain_integration"
path = "tests/monitor_layer_chain_integration.rs"
[[test]]
name = "monitor_lo_0_22"
path = "tests/monitor_lo_0_22.rs"
[[test]]
name = "monitor_lo_dispatch"
path = "tests/monitor_lo_dispatch.rs"
[[test]]
name = "monitor_lo_subscribe"
path = "tests/monitor_lo_subscribe.rs"
[[test]]
name = "monitor_name_in_ctx"
path = "tests/monitor_name_in_ctx.rs"
[[test]]
name = "monitor_replay"
path = "tests/monitor_replay.rs"
[[test]]
name = "monitor_run_until_idle"
path = "tests/monitor_run_until_idle.rs"
[[test]]
name = "monitor_send"
path = "tests/monitor_send.rs"
[[test]]
name = "monitor_smoke"
path = "tests/monitor_smoke.rs"
[[test]]
name = "monitor_subscribe"
path = "tests/monitor_subscribe.rs"
[[test]]
name = "multi_capture"
path = "tests/multi_capture.rs"
[[test]]
name = "multi_stream_config"
path = "tests/multi_stream_config.rs"
[[test]]
name = "pattern_detector_macro"
path = "tests/pattern_detector_macro.rs"
[[test]]
name = "polish_0_22"
path = "tests/polish_0_22.rs"
[[test]]
name = "protocol_plugin"
path = "tests/protocol_plugin.rs"
[[test]]
name = "protocol_roles"
path = "tests/protocol_roles.rs"
[[test]]
name = "report_model"
path = "tests/report_model.rs"
[[test]]
name = "sharded_lo_merge"
path = "tests/sharded_lo_merge.rs"
[[test]]
name = "sharded_merge"
path = "tests/sharded_merge.rs"
[[test]]
name = "sharded_runner"
path = "tests/sharded_runner.rs"
[[test]]
name = "statistics"
path = "tests/statistics.rs"
[[test]]
name = "stream_api_completion"
path = "tests/stream_api_completion.rs"
[[test]]
name = "stream_observability"
path = "tests/stream_observability.rs"
[[test]]
name = "tcp_rst_and_umbrellas"
path = "tests/tcp_rst_and_umbrellas.rs"
[[test]]
name = "timeout"
path = "tests/timeout.rs"
[[test]]
name = "typed_flow_packet_event"
path = "tests/typed_flow_packet_event.rs"
[[test]]
name = "with_dedup_propagation"
path = "tests/with_dedup_propagation.rs"
[[test]]
name = "xdp"
path = "tests/xdp.rs"
[[bench]]
name = "throughput"
path = "benches/throughput.rs"
harness = false
[[bench]]
name = "zero_alloc"
path = "benches/zero_alloc.rs"
harness = false
required-features = ["bench-zero-alloc"]
[dependencies.ahash]
version = "0.8"
optional = true
default-features = false
[dependencies.arrayvec]
version = "0.7"
[dependencies.aya]
version = "0.13"
optional = true
[dependencies.bitflags]
version = "2"
[dependencies.bytes]
version = "1"
optional = true
[dependencies.crossbeam-channel]
version = "0.5"
optional = true
[dependencies.dhat]
version = "0.3"
optional = true
[dependencies.etherparse]
version = "0.16"
optional = true
[dependencies.flowscope]
version = "0.14.1"
default-features = false
[dependencies.futures-core]
version = "0.3"
features = ["std"]
optional = true
default-features = false
[dependencies.libc]
version = "0.2"
[dependencies.metrics]
version = "0.24"
optional = true
[dependencies.nix]
version = "0.31"
features = [
"socket",
"mman",
"poll",
"net",
"ioctl",
]
[dependencies.pcap-file]
version = "2"
optional = true
[dependencies.rustc-hash]
version = "2"
[dependencies.serde]
version = "1"
features = ["derive"]
optional = true
[dependencies.serde_json]
version = "1"
optional = true
[dependencies.thiserror]
version = "2"
[dependencies.tokio]
version = "1"
features = [
"io-util",
"net",
"macros",
"rt-multi-thread",
"time",
"signal",
"sync",
]
optional = true
[dependencies.tokio-stream]
version = "0.1"
features = ["sync"]
optional = true
[dependencies.tracing]
version = "0.1"
features = ["std"]
default-features = false
[dependencies.xxhash-rust]
version = "0.8"
features = ["xxh3"]
default-features = false
[dev-dependencies.core_affinity]
version = "0.8"
[dev-dependencies.criterion]
version = "0.5"
features = ["html_reports"]
[dev-dependencies.divan]
version = "0.1"
[dev-dependencies.env_logger]
version = "0.11"
[dev-dependencies.etherparse]
version = "0.16"
[dev-dependencies.futures]
version = "0.3"
[dev-dependencies.proptest]
version = "1"
[dev-dependencies.tempfile]
version = "3"