net

package
v0.0.0-...-14435e2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2016 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	IP   string `json:"ip"`
	Port uint32 `json:"port"`
}

Addr is implemented compatibility to psutil

func (Addr) String

func (a Addr) String() string

type NetConnectionStat

type NetConnectionStat struct {
	Fd     uint32 `json:"fd"`
	Family uint32 `json:"family"`
	Type   uint32 `json:"type"`
	Laddr  Addr   `json:"localaddr"`
	Raddr  Addr   `json:"remoteaddr"`
	Status string `json:"status"`
	Pid    int32  `json:"pid"`
}

func NetConnections

func NetConnections(kind string) ([]NetConnectionStat, error)

Return a list of network connections opened.

func NetConnectionsPid

func NetConnectionsPid(kind string, pid int32) ([]NetConnectionStat, error)

Return a list of network connections opened by a process.

func (NetConnectionStat) String

func (n NetConnectionStat) String() string

type NetIOCountersStat

type NetIOCountersStat struct {
	Name        string `json:"name"`         // interface name
	BytesSent   uint64 `json:"bytes_sent"`   // number of bytes sent
	BytesRecv   uint64 `json:"bytes_recv"`   // number of bytes received
	PacketsSent uint64 `json:"packets_sent"` // number of packets sent
	PacketsRecv uint64 `json:"packets_recv"` // number of packets received
	Errin       uint64 `json:"errin"`        // total number of errors while receiving
	Errout      uint64 `json:"errout"`       // total number of errors while sending
	Dropin      uint64 `json:"dropin"`       // total number of incoming packets which were dropped
	Dropout     uint64 `json:"dropout"`      // total number of outgoing packets which were dropped (always 0 on OSX and BSD)
}

func NetIOCounters

func NetIOCounters(pernic bool) ([]NetIOCountersStat, error)

NetIOCounters returnes network I/O statistics for every network interface installed on the system. If pernic argument is false, return only sum of all information (which name is 'all'). If true, every network interface installed on the system is returned separately.

func (NetIOCountersStat) String

func (n NetIOCountersStat) String() string

type NetInterfaceAddr

type NetInterfaceAddr struct {
	Addr string `json:"addr"`
}

NetInterfaceAddr is designed for represent interface addresses

func (NetInterfaceAddr) String

func (n NetInterfaceAddr) String() string

type NetInterfaceStat

type NetInterfaceStat struct {
	MTU          int                `json:"mtu"`          // maximum transmission unit
	Name         string             `json:"name"`         // e.g., "en0", "lo0", "eth0.100"
	HardwareAddr string             `json:"hardwareaddr"` // IEEE MAC-48, EUI-48 and EUI-64 form
	Flags        []string           `json:"flags"`        // e.g., FlagUp, FlagLoopback, FlagMulticast
	Addrs        []NetInterfaceAddr `json:"addrs"`
}

func NetInterfaces

func NetInterfaces() ([]NetInterfaceStat, error)

func (NetInterfaceStat) String

func (n NetInterfaceStat) String() string

type NetProtoCountersStat

type NetProtoCountersStat struct {
	Protocol string           `json:"protocol"`
	Stats    map[string]int64 `json:"stats"`
}

System wide stats about different network protocols

func NetProtoCounters

func NetProtoCounters(protocols []string) ([]NetProtoCountersStat, error)

NetProtoCounters returns network statistics for the entire system If protocols is empty then all protocols are returned, otherwise just the protocols in the list are returned. Available protocols:

ip,icmp,icmpmsg,tcp,udp,udplite

func (NetProtoCountersStat) String

func (n NetProtoCountersStat) String() string

Jump to

Keyboard shortcuts

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