pcap

package
v0.0.0-...-c3550ec Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	PcapHandle *pcap.Handle

	PacketHandler PacketHandler

	Timer        time.Duration
	TimerHandler TimerHandler

	File    string
	Device  string
	Promisc bool
	Snaplen int
	Timeout time.Duration
	Filter  string
	MaxPkts int
	MaxTime time.Duration
}

Listener is a pcap listener that reads packets from a file or device and calls Handlers for packets and timer events

func (*Listener) Loop

func (l *Listener) Loop()

Loop implements the listen loop for the listen function

func (*Listener) Prepare

func (l *Listener) Prepare()

Prepare prepares the pcap listener for the listen function

type PacketHandler

type PacketHandler interface {
	HandlePacket(gopacket.Packet)
}

PacketHandler is the interface called by Listener for handling packets

type TimerHandler

type TimerHandler interface {
	HandleTimer()
}

TimerHandler is the interface called by Listener for timer events

Jump to

Keyboard shortcuts

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