socket

package
v1.6.19 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UndefinedProcessID signifies that the process ID is unknown.
	// It must match portmaster/process.UndefinedProcessID
	// It is duplicated here because of import loops.
	UndefinedProcessID = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	IP   net.IP
	Port uint16
}

Address is an IP + Port pair.

type BindInfo

type BindInfo struct {
	sync.Mutex

	Local Address
	PID   int
	UID   int
	Inode int

	ListensAny bool
}

BindInfo holds socket information returned by the system.

func (*BindInfo) GetPID

func (i *BindInfo) GetPID() int

GetPID returns the PID.

func (*BindInfo) GetUID

func (i *BindInfo) GetUID() int

GetUID returns the UID.

func (*BindInfo) GetUIDandInode

func (i *BindInfo) GetUIDandInode() (int, int)

GetUIDandInode returns the UID and Inode.

func (*BindInfo) SetPID

func (i *BindInfo) SetPID(pid int)

SetPID sets the PID to the given value.

type ConnectionInfo

type ConnectionInfo struct {
	sync.Mutex

	Local  Address
	Remote Address
	PID    int
	UID    int
	Inode  int
}

ConnectionInfo holds socket information returned by the system.

func (*ConnectionInfo) GetPID

func (i *ConnectionInfo) GetPID() int

GetPID returns the PID.

func (*ConnectionInfo) GetUID

func (i *ConnectionInfo) GetUID() int

GetUID returns the UID.

func (*ConnectionInfo) GetUIDandInode

func (i *ConnectionInfo) GetUIDandInode() (int, int)

GetUIDandInode returns the UID and Inode.

func (*ConnectionInfo) SetPID

func (i *ConnectionInfo) SetPID(pid int)

SetPID sets the PID to the given value.

type Info

type Info interface {
	GetPID() int
	SetPID(pid int)
	GetUID() int
	GetUIDandInode() (int, int)
}

Info is a generic interface to both ConnectionInfo and BindInfo.

Jump to

Keyboard shortcuts

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