Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListDeviceNames ¶
ListDevicesNames returns the list of adapters available for sniffing on this computer. If the withDescription parameter is set to true, a human readable version of the adapter name is added. If the withIP parameter is set to true, IP address of the adapter is added.
Types ¶
type Sniffer ¶
type Sniffer struct {
// contains filtered or unexported fields
}
Sniffer provides packet sniffing capabilities, forwarding packets read to a Worker.
func New ¶
func New( testMode bool, filter string, factory WorkerFactory, interfaces config.InterfacesConfig, ) (*Sniffer, error)
New create a new Sniffer instance. Settings are validated in a best effort only, but no device is opened yet. Accessing and configuring the actual device is done by the Run method.
func (*Sniffer) Run ¶
Run opens the sniffing device and processes packets being read from that device. Worker instances are instantiated as needed.
type Worker ¶
type Worker interface {
OnPacket(data []byte, ci *gopacket.CaptureInfo)
}
Worker defines the callback interfaces a Sniffer instance will use to forward packets.
Source Files
¶
- afpacket.go
- afpacket_linux.go
- device.go
- file.go
- sniffer.go