sockets

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LISTEN = 1024
)

Variables

This section is empty.

Functions

func GetListeningPorts

func GetListeningPorts(ctx context.Context) (map[int]ProcessSockets, error)

func GetProcessSockets

func GetProcessSockets() (map[int][]uint64, error)

func GetSocketInodesFor

func GetSocketInodesFor(pid int) ([]uint64, error)

Types

type ProcessSockets

type ProcessSockets struct {
	Pid     int
	Sockets []*Socket
}

func (*ProcessSockets) Ports

func (p *ProcessSockets) Ports() []uint16

type Socket

type Socket struct {
	Family  uint8
	State   uint8
	Timer   uint8
	Retrans uint8
	ID      SocketID
	Expires uint32
	RQueue  uint32
	WQueue  uint32
	UID     uint32
	INode   uint32
}

Socket represents a netlink socket.

func SocketListen

func SocketListen() ([]*Socket, error)

type SocketID

type SocketID struct {
	SourcePort      uint16
	DestinationPort uint16
	Source          netip.Addr
	Destination     netip.Addr
	Interface       uint32
	Cookie          [2]uint32
}

Jump to

Keyboard shortcuts

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