package net
import "github.com/shirou/gopsutil/v3/net"
Index ¶
- type Addr
- type ConnectionStat
- 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 ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error)
- func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]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 (n ConnectionStat) String() string
- type ConntrackStat
- 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 (n ConntrackStat) String() string
- type ConntrackStatList
- func NewConntrackStatList() *ConntrackStatList
- func (l *ConntrackStatList) Append(c *ConntrackStat)
- func (l *ConntrackStatList) Items() []ConntrackStat
- func (l *ConntrackStatList) Summary() []ConntrackStat
- type FilterStat
- func FilterCounters() ([]FilterStat, error)
- func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error)
- type IOCountersStat
- func IOCounters(pernic bool) ([]IOCountersStat, error)
- func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error)
- func (n IOCountersStat) String() string
- type InterfaceAddr
- type InterfaceAddrList
- type InterfaceStat
- type InterfaceStatList
- func Interfaces() (InterfaceStatList, error)
- func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error)
- func (l InterfaceStatList) String() string
- type ProtoCountersStat
Types ¶
type Addr ¶
Addr is implemented compatibility to psutil
func (Addr) String ¶
type ConnectionStat ¶
type ConnectionStat 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"` Uids []int32 `json:"uids"` Pid int32 `json:"pid"` }
func Connections ¶
func Connections(kind string) ([]ConnectionStat, error)
func ConnectionsMax ¶
func ConnectionsMax(kind string, max int) ([]ConnectionStat, error)
func ConnectionsMaxWithContext ¶
func ConnectionsMaxWithoutUidsWithContext ¶
func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error)
func ConnectionsPidMaxWithoutUids ¶
func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidMaxWithoutUidsWithContext ¶
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error)
func ConnectionsPidWithoutUids ¶
func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsPidWithoutUidsWithContext ¶
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error)
func ConnectionsWithContext ¶
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
func ConnectionsWithoutUids ¶
func ConnectionsWithoutUids(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 ¶
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error)
func (ConnectionStat) String ¶
func (n ConnectionStat) String() string
type ConntrackStat ¶
type ConntrackStat struct { Entries uint32 `json:"entries"` // Number of entries in the conntrack table Searched uint32 `json:"searched"` // Number of conntrack table lookups performed Found uint32 `json:"found"` // Number of searched entries which were successful New uint32 `json:"new"` // Number of entries added which were not expected before Invalid uint32 `json:"invalid"` // Number of packets seen which can not be tracked Ignore uint32 `json:"ignore"` // Packets seen which are already connected to an entry Delete uint32 `json:"delete"` // Number of entries which were removed DeleteList uint32 `json:"deleteList"` // Number of entries which were put to dying list Insert uint32 `json:"insert"` // Number of entries inserted into the list InsertFailed uint32 `json:"insertFailed"` // # insertion attempted but failed (same entry exists) Drop uint32 `json:"drop"` // Number of packets dropped due to conntrack failure. EarlyDrop uint32 `json:"earlyDrop"` // Dropped entries to make room for new ones, if maxsize reached IcmpError uint32 `json:"icmpError"` // Subset of invalid. Packets that can't be tracked d/t error ExpectNew uint32 `json:"expectNew"` // Entries added after an expectation was already present ExpectCreate uint32 `json:"expectCreate"` // Expectations added ExpectDelete uint32 `json:"expectDelete"` // Expectations deleted SearchRestart uint32 `json:"searchRestart"` // Conntrack table lookups restarted due to hashtable resizes }
ConntrackStat has conntrack summary info
func ConntrackStats ¶
func ConntrackStats(percpu bool) ([]ConntrackStat, error)
func ConntrackStatsWithContext ¶
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error)
func NewConntrackStat ¶
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 (ConntrackStat) String ¶
func (n ConntrackStat) String() string
type ConntrackStatList ¶
type ConntrackStatList struct {
// contains filtered or unexported fields
}
func NewConntrackStatList ¶
func NewConntrackStatList() *ConntrackStatList
func (*ConntrackStatList) Append ¶
func (l *ConntrackStatList) Append(c *ConntrackStat)
func (*ConntrackStatList) Items ¶
func (l *ConntrackStatList) Items() []ConntrackStat
func (*ConntrackStatList) Summary ¶
func (l *ConntrackStatList) Summary() []ConntrackStat
Summary returns a single-element list with totals from all list items.
type FilterStat ¶
type FilterStat struct { ConnTrackCount int64 `json:"connTrackCount"` ConnTrackMax int64 `json:"connTrackMax"` }
func FilterCounters ¶
func FilterCounters() ([]FilterStat, error)
func FilterCountersWithContext ¶
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error)
type IOCountersStat ¶
type IOCountersStat struct { Name string `json:"name"` // interface name BytesSent uint64 `json:"bytesSent"` // number of bytes sent BytesRecv uint64 `json:"bytesRecv"` // number of bytes received PacketsSent uint64 `json:"packetsSent"` // number of packets sent PacketsRecv uint64 `json:"packetsRecv"` // 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) Fifoin uint64 `json:"fifoin"` // total number of FIFO buffers errors while receiving Fifoout uint64 `json:"fifoout"` // total number of FIFO buffers errors while sending }
func IOCounters ¶
func IOCounters(pernic bool) ([]IOCountersStat, error)
func IOCountersWithContext ¶
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error)
func (IOCountersStat) String ¶
func (n IOCountersStat) String() string
type InterfaceAddr ¶
type InterfaceAddr struct { Addr string `json:"addr"` }
NetInterfaceAddr is designed for represent interface addresses
func (InterfaceAddr) String ¶
func (n InterfaceAddr) String() string
type InterfaceAddrList ¶
type InterfaceAddrList []InterfaceAddr
InterfaceAddrList is a list of InterfaceAddr
type InterfaceStat ¶
type InterfaceStat struct { Index int `json:"index"` 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 InterfaceAddrList `json:"addrs"` }
func (InterfaceStat) String ¶
func (n InterfaceStat) String() string
type InterfaceStatList ¶
type InterfaceStatList []InterfaceStat
InterfaceStatList is a list of InterfaceStat
func Interfaces ¶
func Interfaces() (InterfaceStatList, error)
func InterfacesWithContext ¶
func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error)
func (InterfaceStatList) String ¶
func (l InterfaceStatList) String() string
type ProtoCountersStat ¶
type ProtoCountersStat struct { Protocol string `json:"protocol"` Stats map[string]int64 `json:"stats"` }
System wide stats about different network protocols
func ProtoCounters ¶
func ProtoCounters(protocols []string) ([]ProtoCountersStat, error)
func ProtoCountersWithContext ¶
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error)
func (ProtoCountersStat) String ¶
func (n ProtoCountersStat) String() string
Source Files ¶
net.go net_fallback.go net_linux_116.go
- Version
- v3.24.5 (latest)
- Published
- May 28, 2024
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 4 minutes ago –
Tools for package owners.