portlist

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: BSD-3-Clause Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List []Port

List is a list of Ports.

func GetList

func GetList(prev List) (List, error)

func (List) String

func (pl List) String() string

type Poller

type Poller struct {
	// C received the list of ports periodically. It's closed when
	// Run completes, after which Err can be checked.
	C <-chan List

	// Err is the error from the final GetList call. It is only
	// valid to read once C has been closed. Err is nil if Close
	// is called or the context is canceled.
	Err error
	// contains filtered or unexported fields
}

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

func NewPoller

func NewPoller() (*Poller, error)

NewPoller returns a new portlist Poller. It returns an error if the portlist couldn't be obtained.

func (*Poller) Close

func (p *Poller) Close() error

func (*Poller) Run

func (p *Poller) Run(ctx context.Context) error

Run runs the Poller periodically until either the context is done, or the Close is called.

type Port

type Port struct {
	Proto   string // "tcp" or "udp"
	Port    uint16 // port number
	Process string // optional process name, if found
	// contains filtered or unexported fields
}

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