sniffer

package
v5.0.0-alpha3+incompat... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2016 License: Apache-2.0 Imports: 12 Imported by: 320

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDeviceNames

func ListDeviceNames(withDescription bool) ([]string, error)

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.

Types

type AfpacketHandle

type AfpacketHandle struct {
	TPacket *afpacket.TPacket
}

func NewAfpacketHandle

func NewAfpacketHandle(device string, snaplen int, block_size int, num_blocks int,
	timeout time.Duration) (*AfpacketHandle, error)

func (*AfpacketHandle) Close

func (h *AfpacketHandle) Close()

func (*AfpacketHandle) ReadPacketData

func (h *AfpacketHandle) ReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error)

func (*AfpacketHandle) SetBPFFilter

func (h *AfpacketHandle) SetBPFFilter(expr string) (_ error)

type PfringHandle

type PfringHandle struct {
}

func NewPfringHandle

func NewPfringHandle(device string, snaplen int, promisc bool) (*PfringHandle, error)

func (*PfringHandle) Close

func (h *PfringHandle) Close()

func (*PfringHandle) Enable

func (h *PfringHandle) Enable() (_ error)

func (*PfringHandle) ReadPacketData

func (h *PfringHandle) ReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error)

func (*PfringHandle) SetBPFFilter

func (h *PfringHandle) SetBPFFilter(expr string) (_ error)

type SnifferSetup

type SnifferSetup struct {
	DataSource gopacket.PacketDataSource
	// contains filtered or unexported fields
}

func (*SnifferSetup) Close

func (sniffer *SnifferSetup) Close() error
func (sniffer *SnifferSetup) Datalink() layers.LinkType

func (*SnifferSetup) Init

func (sniffer *SnifferSetup) Init(test_mode bool, factory WorkerFactory, interfaces *config.InterfacesConfig) error

func (*SnifferSetup) IsAlive

func (sniffer *SnifferSetup) IsAlive() bool

func (*SnifferSetup) Reopen

func (sniffer *SnifferSetup) Reopen() error

func (*SnifferSetup) Run

func (sniffer *SnifferSetup) Run() error

func (*SnifferSetup) Stop

func (sniffer *SnifferSetup) Stop() error

type Worker

type Worker interface {
	OnPacket(data []byte, ci *gopacket.CaptureInfo)
}

type WorkerFactory

type WorkerFactory func(layers.LinkType) (Worker, string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL