net

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: MIT, BSD-3-Clause Imports: 5 Imported by: 0

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 (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

Jump to

Keyboard shortcuts

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