package net
Import Path
github.com/shirou/gopsutil/v3/net (on go.dev)
Dependency Relation
imports 13 packages, and imported by one package
Package-Level Type Names (total 11)
Addr is implemented compatibility to psutil
IP string
Port uint32
( Addr) String() string
Addr : expvar.Var
Addr : fmt.Stringer
Family uint32
Fd uint32
Laddr Addr
Pid int32
Raddr Addr
Status string
Type uint32
Uids []int32
( ConnectionStat) String() string
ConnectionStat : expvar.Var
ConnectionStat : fmt.Stringer
func Connections(kind string) ([]ConnectionStat, error)
func ConnectionsMax(kind string, max int) ([]ConnectionStat, error)
func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error)
func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error)
func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsPidMax(kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error)
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
func github.com/shirou/gopsutil/v3/process.(*Process).Connections() ([]ConnectionStat, error)
func github.com/shirou/gopsutil/v3/process.(*Process).ConnectionsMax(max int) ([]ConnectionStat, error)
func github.com/shirou/gopsutil/v3/process.(*Process).ConnectionsMaxWithContext(ctx context.Context, max int) ([]ConnectionStat, error)
func github.com/shirou/gopsutil/v3/process.(*Process).ConnectionsWithContext(ctx context.Context) ([]ConnectionStat, error)
ConntrackStat has conntrack summary info
// Number of entries which were removed
// Number of entries which were put to dying list
// Number of packets dropped due to conntrack failure.
// Dropped entries to make room for new ones, if maxsize reached
// Number of entries in the conntrack table
// Expectations added
// Expectations deleted
// Entries added after an expectation was already present
// Number of searched entries which were successful
// Subset of invalid. Packets that can't be tracked d/t error
// Packets seen which are already connected to an entry
// Number of entries inserted into the list
// # insertion attempted but failed (same entry exists)
// Number of packets seen which can not be tracked
// Number of entries added which were not expected before
// Conntrack table lookups restarted due to hashtable resizes
// Number of conntrack table lookups performed
( ConntrackStat) String() string
ConntrackStat : expvar.Var
ConntrackStat : fmt.Stringer
func ConntrackStats(percpu bool) ([]ConntrackStat, error)
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error)
func NewConntrackStat(e uint32, s uint32, f uint32, n uint32, inv uint32, ign uint32, del uint32, dlst uint32, ins uint32, insfail uint32, drop uint32, edrop uint32, ie uint32, en uint32, ec uint32, ed uint32, sr uint32) *ConntrackStat
func (*ConntrackStatList).Items() []ConntrackStat
func (*ConntrackStatList).Summary() []ConntrackStat
func (*ConntrackStatList).Append(c *ConntrackStat)
(*ConntrackStatList) Append(c *ConntrackStat)
(*ConntrackStatList) Items() []ConntrackStat
Summary returns a single-element list with totals from all list items.
func NewConntrackStatList() *ConntrackStatList
ConnTrackCount int64
ConnTrackMax int64
func FilterCounters() ([]FilterStat, error)
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error)
NetInterfaceAddr is designed for represent interface addresses
Addr string
( InterfaceAddr) String() string
InterfaceAddr : expvar.Var
InterfaceAddr : fmt.Stringer
InterfaceAddrList is a list of InterfaceAddr
Addrs InterfaceAddrList
// e.g., FlagUp, FlagLoopback, FlagMulticast
// IEEE MAC-48, EUI-48 and EUI-64 form
Index int
// maximum transmission unit
// e.g., "en0", "lo0", "eth0.100"
( InterfaceStat) String() string
InterfaceStat : expvar.Var
InterfaceStat : fmt.Stringer
InterfaceStatList is a list of InterfaceStat
( InterfaceStatList) String() string
InterfaceStatList : expvar.Var
InterfaceStatList : fmt.Stringer
func Interfaces() (InterfaceStatList, error)
func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error)
// number of bytes received
// number of bytes sent
// total number of incoming packets which were dropped
// total number of outgoing packets which were dropped (always 0 on OSX and BSD)
// total number of errors while receiving
// total number of errors while sending
// total number of FIFO buffers errors while receiving
// total number of FIFO buffers errors while sending
// interface name
// number of packets received
// number of packets sent
( IOCountersStat) String() string
IOCountersStat : expvar.Var
IOCountersStat : fmt.Stringer
func IOCounters(pernic bool) ([]IOCountersStat, error)
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error)
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error)
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error)
System wide stats about different network protocols
Protocol string
Stats map[string]int64
( ProtoCountersStat) String() string
ProtoCountersStat : expvar.Var
ProtoCountersStat : fmt.Stringer
func ProtoCounters(protocols []string) ([]ProtoCountersStat, error)
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error)
Package-Level Functions (total 33)
Return a list of network connections opened.
Return a list of network connections opened returning at most `max`
connections for each running process.
func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error)
Return a list of network connections opened by a process.
Return up to `max` network connections opened by a process.
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
Return a list of network connections opened, omitting `Uids`.
WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
removed from the API in the future.
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
ConntrackStats returns more detailed info about the conntrack table
ConntrackStatsWithContext returns more detailed info about the conntrack table
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.
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) func Interfaces() (InterfaceStatList, error) func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error)
NetIOCounters returns 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 IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) func NewConntrackStat(e uint32, s uint32, f uint32, n uint32, inv uint32, ign uint32, del uint32, dlst uint32, ins uint32, insfail uint32, drop uint32, edrop uint32, ie uint32, en uint32, ec uint32, ed uint32, sr uint32) *ConntrackStat
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 PidsWithContext(ctx context.Context) ([]int32, error)
ProtoCounters 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 ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error)
Reverse reverses array of bytes.
func ReverseWithContext(ctx context.Context, s []byte) []byte
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |