pcap

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReadTimeout = 30 * time.Second
)

Variables

View Source
var (
	ErrConsumerAlreadyRegistered    = errors.New("consumer with the given name is already registered")
	ErrNoMatchingConsumerRegistered = errors.New("no consumer with given key is registered")
	DefaultRecordingOptions         = RecordingOptions{
		ReadTimeout: DefaultReadTimeout,
		Promiscuous: false,
	}
)
View Source
var ErrTransportStillRunning = errors.New("transport to consumers did not stop in time")

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	Name() string
	Observe(pkg gopacket.Packet)
	Init() error
}

type Device

type Device struct {
	Name        string
	IPAddresses []net.IP
}

type Recorder

type Recorder interface {
	io.Closer
	AvailableDevices() (devices []Device, err error)
	Subscriptions() (subscriptions []Subscription)
	StartRecording(ctx context.Context, device string, consumer Consumer) (result *StartRecordingResult, err error)
	StartRecordingWithOptions(
		ctx context.Context,
		device string,
		consumer Consumer,
		opts RecordingOptions,
	) (result *StartRecordingResult, err error)
	StopRecording(consumerKey string) (err error)
}

func NewRecorder

func NewRecorder() Recorder

type RecordingOptions

type RecordingOptions struct {
	Promiscuous bool
	ReadTimeout time.Duration
}

type StartRecordingResult added in v0.5.1

type StartRecordingResult struct {
	ConsumerKey string
}

type Subscription

type Subscription struct {
	ConsumerKey  string
	ConsumerName string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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