pcap

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProcNetDir         = "/proc/net"
	AllConnectionTypes = []string{"tcp", "udp", "tcp6", "udp6"}
)

Functions

func CapturePackets

func CapturePackets(sources []PacketSource) <-chan CapturedPacket

func HashConnection

func HashConnection(typ string, ip string, port int, fip string, fport int) interface{}

Types

type CaptureError

type CaptureError error

type CapturedPacket

type CapturedPacket struct {
	Packet Packet
	Size   uint64
	Err    error
}

type Connection

type Connection struct {
	State string
	Type  string
	Inode string

	Ip    string
	Port  int
	Fip   string
	Fport int

	RxBytes   uint64
	RxPackets uint64
	TxBytes   uint64
	TxPackets uint64
}

func ReadAllConnections

func ReadAllConnections() ([]*Connection, error)

func ReadConnections

func ReadConnections(typ string) ([]*Connection, error)

func (*Connection) HasData

func (con *Connection) HasData() bool

func (*Connection) Hash

func (con *Connection) Hash() interface{}

func (*Connection) LogRxPacket

func (con *Connection) LogRxPacket(size uint64)

func (*Connection) LogTxPacket

func (con *Connection) LogTxPacket(size uint64)

func (*Connection) ReverseHash

func (con *Connection) ReverseHash() interface{}

func (*Connection) String

func (con *Connection) String() string

type ConnectionSlice

type ConnectionSlice []*Connection

func (ConnectionSlice) Len

func (s ConnectionSlice) Len() int

func (ConnectionSlice) Less

func (s ConnectionSlice) Less(i, j int) bool

func (ConnectionSlice) Swap

func (s ConnectionSlice) Swap(i, j int)

type Connections

type Connections struct {
	// contains filtered or unexported fields
}

func NewConnections

func NewConnections() *Connections

func (*Connections) CapturePackets

func (cons *Connections) CapturePackets(sources []PacketSource, errorCallback func(error))

func (*Connections) FilterConnections

func (cons *Connections) FilterConnections(pids []int) ([]*Connection, error)

func (*Connections) LogExistingConnection

func (cons *Connections) LogExistingConnection(info *Connection, size uint64) (logged bool)

func (*Connections) LogPacket

func (cons *Connections) LogPacket(info *Connection, size uint64) error

func (*Connections) LogUnknownConnection

func (cons *Connections) LogUnknownConnection(typ string, size uint64) error

func (*Connections) Sorted

func (cons *Connections) Sorted() []*Connection

func (*Connections) Update

func (cons *Connections) Update() error

type Packet

type Packet interface {
	Info() (*Connection, error)
}

type PacketSource

type PacketSource interface {
	Capture() CapturedPacket
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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