capture

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAddr is the default capture address.
	DefaultAddr = "0.0.0.0:80"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capture

type Capture struct {
	Host       string
	Port       string
	DeviceType Type
	Interfaces []pcap.Interface

	Response bool
}

Capture represents an intent to capture traffic.

func NewCapture

func NewCapture(addr string, response bool) (*Capture, error)

NewCapture creates a new capture.

type Listener

type Listener interface {
	Packets() <-chan gopacket.Packet
	Listen(core.Context)
	Close()
}

Listener listens for network traffic on a given address and port.

func NewListener

func NewListener(cap *Capture) Listener

NewListener creates a new listener.

type Type

type Type int

Type represents the type of device.

const (
	// CaptureInvalid is an invalid device type.
	CaptureInvalid Type = iota
	// CaptureIP is a standard IP address.
	CaptureIP
	// CaptureLoopback represents the loopback interface (e.g. 127.0.0.1).
	CaptureLoopback
	// CaptureAll represents all interfaces (e.g. 0.0.0.0).
	CaptureAll
)

Jump to

Keyboard shortcuts

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