gopsutil.v1: gopkg.in/shirou/gopsutil.v1/net Index | Files

package net

import "gopkg.in/shirou/gopsutil.v1/net"

Index

Package Files

net.go net_linux.go

Variables

var TCPStatuses = map[string]string{
    "01": "ESTABLISHED",
    "02": "SYN_SENT",
    "03": "SYN_RECV",
    "04": "FIN_WAIT1",
    "05": "FIN_WAIT2",
    "06": "TIME_WAIT",
    "07": "CLOSE",
    "08": "CLOSE_WAIT",
    "09": "LAST_ACK",
    "0A": "LISTEN",
    "0B": "CLOSING",
}

http://students.mimuw.edu.pl/lxr/source/include/net/tcp_states.h

func Pids Uses

func Pids() ([]int32, error)

Pids retunres all pids. Note: this is a copy of process_linux.Pids() FIXME: Import process occures import cycle. move to common made other platform breaking. Need consider.

func Reverse Uses

func Reverse(s []byte) []byte

Reverse reverses array of bytes.

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:

ip,icmp,icmpmsg,tcp,udp,udplite

func (NetProtoCountersStat) String Uses

func (n NetProtoCountersStat) String() string

Package net imports 11 packages (graph). Updated 2018-06-02. Refresh now. Tools for package owners.