Movatterモバイル変換


[0]ホーム

URL:


sockstats

package
v1.92.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:4Imported by:24

Details

Repository

github.com/tailscale/tailscale

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

View Source
const IsAvailable =false

Variables

This section is empty.

Functions

funcDebugInfoadded inv1.40.0

func DebugInfo()string

DebugInfo returns a string containing debug information about the trackedstatistics.

funcSetNetMonadded inv1.40.0

func SetNetMon(netMon *netmon.Monitor)

SetNetMon configures the sockstats package to monitor the activeinterface, so that per-interface stats can be collected.

funcWithSockStats

func WithSockStats(ctxcontext.Context, labelLabel, logflogger.Logf)context.Context

WithSockStats instruments a context so that sockets created with it willhave their statistics collected.

Types

typeInterfaceSockStatadded 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.

typeInterfaceSockStatsadded 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.

funcGetInterfacesadded 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.

func (Label)String

func (iLabel) String()string

typeSockStat

type SockStat struct {TxBytesuint64RxBytesuint64}

SockStat contains the sent and received bytes for a socket instrumented withthe WithSockStats() function.

typeSockStats

type SockStats struct {Stats                    map[Label]SockStatCurrentInterfaceCellularbool}

SockStats contains statistics for sockets instrumented with theWithSockStats() function

funcGet

func Get() *SockStats

Get returns the current socket statistics.

typeValidationSockStat

type ValidationSockStat struct {TxBytesuint64RxBytesuint64}

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.

funcGetValidationadded 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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp