packetdump

package
v0.0.0-...-cd81286 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: GPL-3.0, Apache-2.0 Imports: 12 Imported by: 1

README

This package is a simple BPF program to dump headers of packets passing a specific interface into a Go channel.

Based on the work done in https://github.com/iovisor/gobpf/pull/270.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

type Packet struct {
	SrcAddr       net.IP
	DstAddr       net.IP
	InIf          uint32
	OutIf         uint32
	Bytes         uint32
	Etype         uint32
	Proto         uint32
	Ipv6FlowLabel uint32
	SrcPort       uint16
	DstPort       uint16
	IPTtl         uint8
	IPTos         uint8
	IcmpType      uint8
	IcmpCode      uint8
	TcpFlags      uint8
	FlowDirection uint8
	RemoteAddr    uint8
}

type PacketDumper

type PacketDumper struct {
	BufSize int // Determines kernel perf map allocation. It is rounded up to the nearest multiple of the current page size.

	SamplerAddress net.IP
	// contains filtered or unexported fields
}

func (*PacketDumper) Packets

func (b *PacketDumper) Packets() chan Packet

func (*PacketDumper) Setup

func (b *PacketDumper) Setup(device string) error

func (*PacketDumper) Start

func (b *PacketDumper) Start() error

func (*PacketDumper) Stop

func (b *PacketDumper) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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