gopsutil: Index | Files

package net

import ""


Package Files

net.go net_linux.go net_unix.go

type Addr Uses

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

Addr is implemented compatibility to psutil

func (Addr) String Uses

func (a Addr) String() string

type NetConnectionStat Uses

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 Uses

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

Return a list of network connections opened.

func NetConnectionsPid Uses

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

Return a list of network connections opened by a process.

func (NetConnectionStat) String Uses

func (n NetConnectionStat) String() string

type NetFilterStat Uses

type NetFilterStat struct {
    ConnTrackCount int64 `json:"conntrack_count"`
    ConnTrackMax   int64 `json:"conntrack_max"`

func NetFilterCounters Uses

func NetFilterCounters() ([]NetFilterStat, error)

NetFilterCounters returns iptables conntrack statistics the currently in use conntrack count and the max. If the file does not exist or is invalid it will return nil.

type NetIOCountersStat Uses

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 Uses

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 NetIOCountersByFile Uses

func NetIOCountersByFile(pernic bool, filename string) ([]NetIOCountersStat, error)

func (NetIOCountersStat) String Uses

func (n NetIOCountersStat) String() string

type NetInterfaceAddr Uses

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

NetInterfaceAddr is designed for represent interface addresses

func (NetInterfaceAddr) String Uses

func (n NetInterfaceAddr) String() string

type NetInterfaceStat Uses

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 Uses

func NetInterfaces() ([]NetInterfaceStat, error)

func (NetInterfaceStat) String Uses

func (n NetInterfaceStat) String() string

type NetProtoCountersStat Uses

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

System wide stats about different network protocols

func NetProtoCounters Uses

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:


func (NetProtoCountersStat) String Uses

func (n NetProtoCountersStat) String() string

Package net imports 8 packages (graph) and is imported by 1 packages. Updated 2018-06-19. Refresh now. Tools for package owners.