portlist

package
v0.0.0-...-ded95ce Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: BSD-3-Clause Imports: 22 Imported by: 0

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

This section is empty.

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 {
	// 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

Close closes the Poller. Run will return with a nil 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.

Run may only be called once.

func (*Poller) Updates

func (p *Poller) Updates() <-chan List

Updates return the channel that receives port list updates.

The channel is closed when the Poller is closed.

type Port

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

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