sockstats
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package sockstats collects statistics about network sockets used bythe Tailscale client. The context where sockets are used must beinstrumented with the WithSockStats() function.
Only available on POSIX platforms when built with Tailscale's fork of Go.
Index¶
Constants¶
const IsAvailable =falseVariables¶
This section is empty.
Functions¶
funcDebugInfo¶added inv1.40.0
func DebugInfo()string
DebugInfo returns a string containing debug information about the trackedstatistics.
Types¶
typeInterfaceSockStat¶added inv1.40.0
type InterfaceSockStat struct {TxBytesByInterface map[string]uint64RxBytesByInterface map[string]uint64}InterfaceSockStat contains the per-interface sent and received bytes for asocket instrumented with the WithSockStats() function.
typeInterfaceSockStats¶added inv1.40.0
type InterfaceSockStats struct {Stats map[Label]InterfaceSockStatInterfaces []string}InterfaceSockStats contains statistics for sockets instrumented with theWithSockStats() function, broken down by interface. The statistics may be asubset of the total if interfaces were added after the instrumented socketwas created.
funcGetInterfaces¶added inv1.40.0
func GetInterfaces() *InterfaceSockStats
GetWithInterfaces is a variant of Get that returns the current socketstatistics broken down by interface. It is slightly more expensive than Get.
typeLabel¶
type Labeluint8
Label is an identifier for a socket that stats are collected for. A finiteset of values that may be used to label a socket to encourage grouping andto make storage more efficient.
const (LabelControlClientAutoLabel = 0// control/controlclient/auto.goLabelControlClientDialerLabel = 1// control/controlhttp/client.goLabelDERPHTTPClientLabel = 2// derp/derphttp/derphttp_client.goLabelLogtailLoggerLabel = 3// logtail/logtail.goLabelDNSForwarderDoHLabel = 4// net/dns/resolver/forwarder.goLabelDNSForwarderUDPLabel = 5// net/dns/resolver/forwarder.goLabelNetcheckClientLabel = 6// net/netcheck/netcheck.goLabelPortmapperClientLabel = 7// net/portmapper/portmapper.goLabelMagicsockConnUDP4Label = 8// wgengine/magicsock/magicsock.goLabelMagicsockConnUDP6Label = 9// wgengine/magicsock/magicsock.goLabelNetlogLoggerLabel = 10// wgengine/netlog/logger.goLabelSockstatlogLoggerLabel = 11// log/sockstatlog/logger.goLabelDNSForwarderTCPLabel = 12// net/dns/resolver/forwarder.go)
Labels are named after the package and function/struct that uses the socket.Values may be persisted and thus existing entries should not be re-numbered.
typeSockStat¶
SockStat contains the sent and received bytes for a socket instrumented withthe WithSockStats() function.
typeSockStats¶
SockStats contains statistics for sockets instrumented with theWithSockStats() function
typeValidationSockStat¶
ValidationSockStat contains the validation bytes for a socket instrumentedwith WithSockStats.
typeValidationSockStats¶
type ValidationSockStats struct {Stats map[Label]ValidationSockStat}ValidationSockStats contains external validation numbers for socketsinstrumented with WithSockStats. It may be a subset of the all sockets,depending on what externa measurement mechanisms the platform supports.
funcGetValidation¶added inv1.40.0
func GetValidation() *ValidationSockStats
GetValidation is a variant of Get that returns external validation numbersfor stats. It is more expensive than Get and should be used in debuginterfaces only.