portlist

package
v1.69.0-pre Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: BSD-3-Clause Imports: 22 Imported by: 3

Documentation

Overview

The portlist package contains code that checks what ports are open and listening on the current machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PollInterval added in v1.44.0

func PollInterval() time.Duration

PollInterval is the recommended OS-specific interval to wait between *Poller.Poll method calls.

Types

type List

type List []Port

List is a list of Ports.

func (List) String

func (pl List) String() string

type Poller

type Poller struct {
	// IncludeLocalhost controls whether services bound to localhost are included.
	//
	// This field should only be changed before calling Run.
	IncludeLocalhost bool
	// contains filtered or unexported fields
}

Poller scans the systems for listening ports periodically and sends the results to C.

func (*Poller) Close

func (p *Poller) Close() error

Close closes the Poller.

func (*Poller) Poll added in v1.44.0

func (p *Poller) Poll() (ports []Port, changed bool, err error)

Poll returns the list of listening ports, if changed from a previous call as indicated by the changed result.

type Port

type Port struct {
	Proto   string // "tcp" or "udp"
	Port    uint16 // port number
	Process string // optional process name, if found (requires suitable permissions)
	Pid     int    // process ID, if known (requires suitable permissions)
}

Port is a listening port on the machine.

Jump to

Keyboard shortcuts

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