| 01-capture-and-classification |
02 |
capture |
| go-pcap |
| gopacket |
| packet-capture |
| privilege-handling |
| cgo-free-capture |
|
| phase |
provides |
| 01-capture-and-classification/01-01 |
classify/types.go with TrafficClass, ClassifiedPacket, WindowSnapshot types |
|
|
| capture package with OpenCapture, ListInterfaces, StartCapture functions |
| Platform-specific privilege error messages (Linux setcap hint, macOS sudo hint) |
| Channel-based packet source with 512-buffer and atomic drop counter |
|
| cmd/root.go (will call StartCapture and ListInterfaces) |
| Phase 2 audio synthesis (receives packets from StartCapture channel) |
|
| added |
patterns |
| github.com/packetcap/go-pcap v0.0.0-20251215 (pure-Go live capture) |
| github.com/sirupsen/logrus v1.9.3 (transitive dep of go-pcap) |
|
| TDD RED/GREEN |
| write failing tests before implementation |
|
| net.Interfaces() for listing (not pcap.FindAllDevs which go-pcap lacks) |
| Non-blocking channel send with atomic.AddInt64 drop counter |
| Dynamic link type via layers.LinkType(handle.LinkType()) |
| runtime.GOOS switch for platform-specific error messages |
|
|
| created |
modified |
| capture/capture.go |
| capture/capture_test.go |
|
| go.mod (added go-pcap) |
| go.sum (added go-pcap + logrus hashes) |
|
|
| Use net.Interfaces() for interface listing — go-pcap has no FindAllDevs equivalent |
| StartCapture uses 512-buffered channel with atomic drop counter to avoid backpressure blocking capture goroutine |
| Dynamic link type detection via handle.LinkType() — not hardcoded LinkTypeEthernet |
| Permission errors wrap platform-specific messages: Linux shows setcap, macOS shows sudo |
|
| Privilege detection: check error string for 'permission denied', 'operation not permitted', 'pcap_create' |
| Platform branching: switch runtime.GOOS with linux case explicit, default for darwin/others |
| Packet pipeline: goroutine reads from packetSource, writes to buffered channel with non-blocking select |
|
|
2min |
2026-03-25 |