stats

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// LAN kinds count a tun hub's peer-LAN routing: what the hub refused,
	// what it put into its table, and what it took out again. They are
	// counted by the hub's RIB, not by the packet path, because the RIB is
	// where those three decisions are actually made.
	KindLanRouted    stats.Kind = 103
	KindLanDenied    stats.Kind = 104
	KindLanWithdrawn stats.Kind = 105
)

LAN statistic kinds, defined here in x because core/ must stay untouched. Core uses 1-5; 101+ is x-private space.

Variables

This section is empty.

Functions

func NewStats

func NewStats(resetTraffic bool) stats.Stats

NewStats creates a new Stats instance. When resetTraffic is true, calls to Get for KindInputBytes and KindOutputBytes atomically reset the counter to zero after reading, which is useful for rate calculations.

Types

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Stats implements the stats.Stats interface using atomic counters. When resetTraffic is true, Get for KindInputBytes and KindOutputBytes atomically swaps the counter with zero, returning the value at the time of the call.

func (*Stats) Add

func (s *Stats) Add(kind stats.Kind, n int64)

func (*Stats) Get

func (s *Stats) Get(kind stats.Kind) uint64

func (*Stats) IsUpdated

func (s *Stats) IsUpdated() bool

func (*Stats) Reset

func (s *Stats) Reset()

type StatsEvent

type StatsEvent struct {
	Kind    string
	Service string
	Client  string

	TotalConns   uint64
	CurrentConns uint64
	InputBytes   uint64
	OutputBytes  uint64
	TotalErrs    uint64
}

StatsEvent carries a snapshot of all tracked statistics for a specific service and optional client. It implements observer.Event.

func (StatsEvent) Type

func (StatsEvent) Type() observer.EventType

Type returns observer.EventStats to identify this as a statistics event.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL