capture

package
v0.0.0-...-a8fe691 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capturer

type Capturer interface {
	Packets() chan gopacket.Packet
	Filter(string) error
	Close()
}

Capturer is the main interface for capturing packets

func Open

func Open(device string) (Capturer, error)

Open creates a packet capture based on pcapHandle with the jumbo frames enabled Filtering is done by pcapHandle.

type Sample

type Sample struct {
	Transport protos.ProtocolType // Protocol Type
	IcmpType  uint16              // ICMP Type (in case of protocol = ICMPv4 or ICMPv6)
	IcmpCode  uint16              // ICMP Code (in case of protocol = ICMPv4 or ICMPv6)
	SrcPort   uint16              // Source port (in case of protocol = UDP or TCP)
	DstPort   uint16              // Destination port (in case of protocol = UDP or TCP)
	Src       net.IP              // Source IP
	Dst       net.IP              // Destination IP
	Bytes     uint16              // Packet size
}

Sample contains flow data (IP based) annotated with TCP and UDP metadata

func NewSample

func NewSample(p gopacket.Packet) (*Sample, error)

NewSample parses an IP packet and generates a Sample

func (Sample) FlowMeta

func (s Sample) FlowMeta() flow.Meta

FlowMeta extracts flow metadata from a packet

func (Sample) String

func (s Sample) String() string

Jump to

Keyboard shortcuts

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