feat(04-01): add BPF validation, pcap reading, Timestamp field, and filter support

- Add Timestamp time.Time field to ClassifiedPacket (classify/types.go)
- Create capture/bpf.go: ValidateBPFFilter and CompileSoftwareBPF
- Create capture/pcap_reader.go: ReadPcapFile with optional software BPF filter
- Update OpenCapture and StartCapture to accept filter string param
- Update cmd/netsynth/main.go to pass empty filter to StartCapture
- All new tests pass; existing tests unaffected
This commit is contained in:
2026-03-26 14:33:29 +01:00
parent 38c74415ed
commit 52c601019b
7 changed files with 353 additions and 9 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ func run(cmd *cobra.Command, args []string) error {
// Stage 1: Capture (CAPT-01)
fmt.Fprintf(os.Stderr, "Starting capture on %s... (press Ctrl+C to stop)\n", ifaceName)
packets, droppedPtr, err := capture.StartCapture(ctx, ifaceName)
packets, droppedPtr, err := capture.StartCapture(ctx, ifaceName, "")
if err != nil {
return err // CAPT-04: permission error already has platform-specific message
}