Documentation ¶
Overview ¶
Package netstat provides primitives for getting socket information on a Linux based operating system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotEnoughFields = errors.New("gonetstat: not enough fields in the line")
)
Errors returned by gonetstat
Functions ¶
func NoopFilter ¶
func NoopFilter(*SockTabEntry) bool
NoopFilter - a test function returning true for all elements
Types ¶
type AcceptFn ¶
type AcceptFn func(*SockTabEntry) bool
AcceptFn is used to filter socket entries. The value returned indicates whether the element is to be appended to the socket list.
type SkState ¶
type SkState uint8
SkState type represents socket connection state
type SockTabEntry ¶
type SockTabEntry struct { LocalAddr *SockAddr RemoteAddr *SockAddr State SkState UID uint32 Process *Process // contains filtered or unexported fields }
SockTabEntry type represents each line of the /proc/net/[tcp|udp]
func TCP6Socks ¶
func TCP6Socks(accept AcceptFn) ([]SockTabEntry, error)
TCP6Socks returns a slice of active TCP IPv4 sockets containing only those elements that satisfy the accept function
func TCPSocks ¶
func TCPSocks(accept AcceptFn) ([]SockTabEntry, error)
TCPSocks returns a slice of active TCP sockets containing only those elements that satisfy the accept function
func UDP6Socks ¶
func UDP6Socks(accept AcceptFn) ([]SockTabEntry, error)
UDP6Socks returns a slice of active UDP IPv6 sockets containing only those elements that satisfy the accept function
func UDPSocks ¶
func UDPSocks(accept AcceptFn) ([]SockTabEntry, error)
UDPSocks returns a slice of active UDP sockets containing only those elements that satisfy the accept function