state

package
Version: v0.8.10 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UDPConnStateTTL is the maximum time a udp connection state is held.
	UDPConnStateTTL = 72 * time.Hour

	// UDPConnStateShortenedTTL is a shortened maximum time a udp connection state is held, if there more entries than defined by AggressiveCleaningThreshold.
	UDPConnStateShortenedTTL = 3 * time.Hour

	// AggressiveCleaningThreshold defines the soft limit of udp connection state held per udp socket.
	AggressiveCleaningThreshold = 256
)
View Source
const (
	// UDPConnectionTTL defines the duration after which unseen UDP connections are regarded as ended.
	UDPConnectionTTL = 10 * time.Minute
)

Variables

View Source
var (
	ErrConnectionNotFound = errors.New("could not find connection in system state tables")
	ErrPIDNotFound        = errors.New("could not find pid for socket inode")
)

Errors.

Functions

func CleanUDPStates

func CleanUDPStates(_ context.Context)

CleanUDPStates cleans the udp connection states which save connection directions.

func Exists

func Exists(pktInfo *packet.Info, now time.Time) (exists bool)

Exists checks if the given connection is present in the system state tables.

func Lookup

func Lookup(pktInfo *packet.Info, fast bool) (pid int, inbound bool, err error)

Lookup looks for the given connection in the system state tables and returns the PID of the associated process and whether the connection is inbound.

Types

type Info

type Info struct {
	record.Base
	sync.Mutex

	TCP4Connections []*socket.ConnectionInfo
	TCP4Listeners   []*socket.BindInfo
	TCP6Connections []*socket.ConnectionInfo
	TCP6Listeners   []*socket.BindInfo
	UDP4Binds       []*socket.BindInfo
	UDP6Binds       []*socket.BindInfo
}

Info holds network state information as provided by the system.

func GetInfo

func GetInfo() *Info

GetInfo returns all system state tables. The returned data must not be modified.

Jump to

Keyboard shortcuts

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