feat(01-02): implement capture package with OpenCapture, ListInterfaces, StartCapture

- ListInterfaces uses net.Interfaces() stdlib (no pcap dependency for listing)
- OpenCapture wraps packetcap/go-pcap with platform-specific permission error handling
- StartCapture uses buffered channel (512) with atomic drop counter
- Dynamic link type detection via layers.LinkType(handle.LinkType())
- Linux error shows setcap cap_net_raw+ep hint; macOS shows sudo hint
- Add github.com/packetcap/go-pcap v0.0.0-20251215 to go.mod
This commit is contained in:
2026-03-25 12:17:16 +01:00
parent 2a8fd7dd05
commit 9446dd5c27
3 changed files with 129 additions and 0 deletions
+7
View File
@@ -3,3 +3,10 @@ module github.com/netsynth/netsynth
go 1.24.1
require github.com/gopacket/gopacket v1.5.0
require (
github.com/packetcap/go-pcap v0.0.0-20251215121130-f2cf9f991e7c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.32.0 // indirect
)