| 01-capture-and-classification |
04 |
cli |
| go |
| cobra |
| signal-handling |
| channels |
| pipeline |
| cli |
| stderr-output |
|
| phase |
provides |
| 01-capture-and-classification |
capture.StartCapture, capture.ListInterfaces, capture.OpenCapture from capture/capture.go (Plan 02) |
|
| phase |
provides |
| 01-capture-and-classification |
classify.Classifier, classify.DefaultRules, classify.ClassifiedPacket types from classify/ (Plan 01) |
|
| phase |
provides |
| 01-capture-and-classification |
aggregate.Aggregate, aggregate.PrintSummary, aggregate.PrintWindowLine, aggregate.AccumulateTotals from aggregate/ (Plan 03) |
|
|
| Cobra CLI binary (cmd/netsynth/main.go) wiring all three pipeline stages |
| -i / --interface flag for specifying capture interface |
| --list-interfaces flag that enumerates available interfaces and exits |
| --verbose flag enabling per-window protocol activity on stderr |
| Ctrl+C / SIGTERM clean shutdown with Aggregate done-channel propagation |
| Exit summary showing per-protocol packet counts and percentages |
|
|
| added |
patterns |
| github.com/spf13/cobra v1.10.2 (Cobra CLI framework) |
|
| Cobra RunE pattern: RunE returns error, Cobra handles exit code |
| signal.NotifyContext for clean SIGINT/SIGTERM shutdown — cancels context which closes packet channel which drains pipeline |
| Three-stage pipeline via goroutine + channels: capture -> classify -> aggregate |
| Atomic drop counter (droppedPtr) surfaced at exit if non-zero |
|
|
| created |
modified |
| cmd/netsynth/main.go |
| cmd/netsynth/main_test.go |
|
|
|
| Cobra RunE (not Run) used so errors propagate cleanly to stderr and exit code 1 |
| signal.NotifyContext chosen over manual signal.Notify channel — cancels context automatically on SIGINT/SIGTERM, simpler shutdown chain |
| classified channel buffered at 1024 to absorb burst traffic between capture and aggregate goroutines |
| Permission error message lives in capture.StartCapture (Plan 02); main.go just returns it — single source of truth for platform-specific sudo hint |
|
| Pattern: context cancellation is the single stop signal — capture reads ctx.Done(), packet channel close propagates to classify goroutine, which closes classified channel, which drains Aggregate |
| Pattern: pipeline stages communicate only via channels — no shared state beyond atomic drop counter |
|
| CAPT-01 |
| CAPT-02 |
| CAPT-04 |
| CLAS-01 |
| CLAS-03 |
| CLAS-04 |
|
~15min |
2026-03-25 |