ss

package
v0.0.0-...-2854774 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.New("ss: not implemented")
)

errors about ss

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client can manipulate ss netlink interface.

func New

func New() (*Client, error)

New creates a Client which can issue ss commands.

func NewWithConn

func NewWithConn(conn *netlink.Conn) *Client

NewWithConn creates a Client which can issue ss commands using an existing netlink connection.

func (*Client) ListTcp4Conns

func (c *Client) ListTcp4Conns() ([]*Entry, error)

ListTcp4Conns retrieves all tcp connections from kernel.

func (*Client) ListTcp4Listeners

func (c *Client) ListTcp4Listeners() ([]*Entry, error)

ListTcp4Listeners retreives all IPv4 tcp listeners from kernel.

func (*Client) ListTcp6Conns

func (c *Client) ListTcp6Conns() ([]*Entry, error)

ListTcp6Conns retrieves all tcp connections from kernel.

func (*Client) ListTcp6Listeners

func (c *Client) ListTcp6Listeners() ([]*Entry, error)

ListTcp6Listeners retreives all IPv6 tcp listeners from kernel.

func (*Client) ListUdp4Listeners

func (c *Client) ListUdp4Listeners() ([]*Entry, error)

ListUdp4Listeners retreives all IPv4 Udp listeners from kernel.

func (*Client) ListUdp4Sockets

func (c *Client) ListUdp4Sockets() ([]*Entry, error)

ListUdp4Conns retrieves all Udp sockets from kernel.

func (*Client) ListUdp6Listeners

func (c *Client) ListUdp6Listeners() ([]*Entry, error)

ListUdp6Listeners retreives all IPv6 Udp listeners from kernel.

func (*Client) ListUdp6Sockets

func (c *Client) ListUdp6Sockets() ([]*Entry, error)

ListUdp6Conns retrieves all Udp sockets from kernel.

type Entry

type Entry struct {
	State               iproute2.SockStateType
	RecvQ, SendQ        uint32
	LocalAddr, PeerAddr net.IP
	LocalPort, PeerPort int
	Ifindex             int
	Inode               int
	IsIPv4              bool
}

Entry contains sockets' information, such as state, receive queue size, send queue size, local address, local port , peer address and peer port.

type Summary

type Summary struct {
	Sockets    int
	TcpMem     int
	TcpTotal   int
	TcpOrphans int
	TcpTws     int
	Tcp4Hashed int
	Udp4       int
	Raw4       int
	Frag4      int
	Frag4Mem   int
	Tcp6Hashed int
	Udp6       int
	Raw6       int
	Frag6      int
	Frag6Mem   int

	TcpEstablished int
}

Summary is the kernel sockets' statistics.

func (*Summary) GetSockStat

func (s *Summary) GetSockStat() error

GetSockStat reads IPv4 socket statistics data from */proc/net/sockstat*.

func (*Summary) GetSockStat6

func (s *Summary) GetSockStat6() error

GetSockStat6 reads IPv6 socket statistics data from */proc/net/sockstat6*.

func (*Summary) GetTcpEstablished

func (s *Summary) GetTcpEstablished() error

GetTcpEstablished gets the number of established tcp connections from */proc/net/snmp*.

Jump to

Keyboard shortcuts

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