socketsmonitor

package
v0.0.0-...-f54534b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnySocket constant indicates that we should return all sockets found.
	// If the user selected a socket type, family or protocol, the value will be > 0
	AnySocket = 0
)

Variables

View Source
var Name = "sockets-monitor"

Name of this task

Functions

This section is empty.

Types

type Protos

type Protos struct {
	Proto uint8
	Fam   uint8
}

Protos holds valid combinations of protocols, families and socket types that can be created.

type Socket

type Socket struct {
	Socket *netlink.Socket
	Iface  string
	PID    int
	Mark   uint32
	Proto  uint16
}

Socket represents every socket dumped from the kernel for the given filter. Internal to this package, and sent to the GUI as JSON.

type SocketsMonitor

type SocketsMonitor struct {
	tasks.TaskBase

	Ticker *time.Ticker

	Config *monConfig

	// stop the task if the daemon is disconnected from the GUI (server)
	StopOnDisconnect bool
	// contains filtered or unexported fields
}

SocketsMonitor monitors a process ID.

func New

func New(config interface{}, stopOnDisconnect bool) (*SocketsMonitor, error)

New returns a new SocketsMonitor

func (*SocketsMonitor) Errors

func (pm *SocketsMonitor) Errors() <-chan error

Errors ...

func (*SocketsMonitor) Pause

func (pm *SocketsMonitor) Pause() error

Pause stops temporarily the task. For example it might be paused when the connection with the GUI (server) is closed.

func (*SocketsMonitor) Results

func (pm *SocketsMonitor) Results() <-chan interface{}

Results ...

func (*SocketsMonitor) Resume

func (pm *SocketsMonitor) Resume() error

Resume stopped tasks.

func (*SocketsMonitor) Start

func (pm *SocketsMonitor) Start(ctx context.Context, cancel context.CancelFunc) error

Start ...

func (*SocketsMonitor) Stop

func (pm *SocketsMonitor) Stop() error

Stop ...

type SocketsTable

type SocketsTable struct {
	sync.RWMutex `json:"-"`
	Table        []*Socket
	Processes    map[int]*procmon.Process
}

SocketsTable holds all the dumped sockets, after applying the filters, if any.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳