sniffer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2016 License: Apache-2.0 Imports: 17 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 {
	Decoder    *decoder.DecoderStruct
	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,
	icmp4 icmp.ICMPv4Processor,
	icmp6 icmp.ICMPv6Processor,
	tcp tcp.Processor,
	udp udp.Processor,
) 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

Jump to

Keyboard shortcuts

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