How nishisan-dev/n-udptee works
n-udptee passively captures inbound UDP/IPv4 traffic and independently replicates matching datagrams to configured targets while leaving the original receiver undisturbed. The main workflow is CLI configuration loading, ingress capture, frame decoding, first-match rule selection, bounded per-target queuing, and sending through the selected forwarding mode. Metrics and health endpoints provide operational visibility. The README documents these capabilities; the graph’s implementation links rely on the shown source excerpts and SOURCE INDEX, so unsampled details are not expanded.
Main entry points: app.go Service runtime · engine.go Fan-out engine · main.go CLI · raw.go Raw IPv4 sender
Components 15
Ingress capture
- BPF validation
internal/bpf/compile.go - Packet capture
internal/capture/pcap.go - UDP decoder
internal/decode/decode.go
Rules and fan-out
- Datagram model
internal/model/datagram.go - Fan-out engine
internal/engine/engine.go - First-match rules
internal/match/match.go
Forwarding
- Raw IPv4 sender
internal/send/rawipv4/raw.go - UDP socket sender
internal/send/udpsocket/udp.go
Operations
- CLI
cmd/n-udptee/main.go - Configuration
internal/config/config.go - Service runtime
internal/app/app.go - Metrics registry
internal/metrics/metrics.go
Other components
- UDP sender
- Metrics scraper
- Configured receivers
Connections 21
- UDP sender → CLI: starts
README.md - CLI → Configuration: loads
cmd/n-udptee/main.go - CLI → Service runtime: runs
cmd/n-udptee/main.go - Configuration → BPF validation: validates filter
internal/config/config.go - Service runtime → Packet capture: opens
internal/app/app.go - Packet capture → Service runtime: provides packets
internal/app/app.go - Service runtime → UDP decoder: decodes frames
internal/app/app.go - UDP decoder → Datagram model: creates
internal/decode/decode.go - Service runtime → Fan-out engine: submits datagrams
internal/app/app.go - Fan-out engine → First-match rules: matches rules
internal/engine/engine.go - Fan-out engine → Datagram model: queues replicas
internal/engine/engine.go - Service runtime → Raw IPv4 sender: creates in raw mode
internal/app/app.go - Service runtime → UDP socket sender: creates in socket mode
internal/app/app.go - Fan-out engine → Raw IPv4 sender: dispatches sends
- Fan-out engine → UDP socket sender: dispatches sends
- Raw IPv4 sender → Configured receivers: sends replicas
- UDP socket sender → Configured receivers: sends replicas
- Service runtime → Metrics registry: records capture
internal/app/app.go - Fan-out engine → Metrics registry: records queue and sends
internal/engine/engine.go - Metrics scraper → Service runtime: requests metrics
internal/app/app.go - Service runtime → Metrics registry: serves metrics
internal/app/app.go