Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadFileNoStat ¶
ReadFileNoStat uses io.ReadAll to read contents of entire file. This is similar to os.ReadFile but without the call to os.Stat, because many files in /proc and /sys report incorrect file sizes (either 0 or 4096). Reads a max file size of 1024kB. For files larger than this, a scanner should be used.
Types ¶
type NetSockstat ¶
type NetSockstat struct { // Used is non-nil for IPv4 sockstat results, but nil for IPv6. Used *int Protocols []NetSockstatProtocol }
A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6, respectively.
func ParseNetSockstat ¶
func ParseNetSockstat() (*NetSockstat, error)
ParseNetSockstat retrieves IPv4 socket statistics.
func ParseNetSockstat6 ¶
func ParseNetSockstat6() (*NetSockstat, error)
ParseNetSockstat6 retrieves IPv6 socket statistics.
If IPv6 is disabled on this kernel, the returned error can be checked with os.IsNotExist.
type NetSockstatProtocol ¶
type NetSockstatProtocol struct { Protocol string InUse int Orphan *int TW *int Alloc *int Mem *int Memory *int }
A NetSockstatProtocol contains statistics about a given socket protocol. Pointer fields indicate that the value may or may not be present on any given protocol.