Documentation
¶
Overview ¶
Package portlist contains code that checks what ports are open and listening on the current machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("not implemented yet")
ErrNotImplemented is the "not implemented" error given by `gopsutil` when an OS doesn't support and API. Unfortunately it's in an internal package so we can't import it so we'll copy it here.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Local, Remote netip.AddrPort
Pid int
State string
OSMetadata OSMetadata
}
Entry is a single entry in the connection table.
type OSMetadata ¶
type OSMetadata struct{}
OSMetadata includes any additional OS-specific information that may be obtained during the retrieval of a given Entry.
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.
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.
type Table ¶
type Table struct {
Entries []Entry
}
Table contains local machine's TCP connection entries.
Currently only TCP (IPv4 and IPv6) are included.
func GetConnTable ¶
GetConnTable returns the connection table.
It returns ErrNotImplemented if the table is not available for the current operating system.