connstats

package
v1.34.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: BSD-3-Clause Imports: 4 Imported by: 10

Documentation

Overview

Package connstats maintains statistics about connections flowing through a TUN device (which operate at the IP layer).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Statistics

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

Statistics maintains counters for every connection. All methods are safe for concurrent use. The zero value is ready for use.

func (*Statistics) Extract

func (s *Statistics) Extract() (virtual, physical map[netlogtype.Connection]netlogtype.Counts)

Extract extracts and resets the counters for all active connections. It must be called periodically otherwise the memory used is unbounded.

func (*Statistics) UpdateRxPhysical

func (s *Statistics) UpdateRxPhysical(src netip.Addr, dst netip.AddrPort, n int)

UpdateRxPhysical updates the counters for a received wireguard packet. The src is always a Tailscale IP address, representing some remote peer. The dst is a remote IP address and port that corresponds with some physical peer backing the Tailscale IP address.

func (*Statistics) UpdateRxVirtual

func (s *Statistics) UpdateRxVirtual(b []byte)

UpdateRxVirtual updates the counters for a received IP packet. The source and destination of the packet are inverted with respect to the source and destination in netlogtype.Connection.

func (*Statistics) UpdateTxPhysical

func (s *Statistics) UpdateTxPhysical(src netip.Addr, dst netip.AddrPort, n int)

UpdateTxPhysical updates the counters for a transmitted wireguard packet The src is always a Tailscale IP address, representing some remote peer. The dst is a remote IP address and port that corresponds with some physical peer backing the Tailscale IP address.

func (*Statistics) UpdateTxVirtual

func (s *Statistics) UpdateTxVirtual(b []byte)

UpdateTxVirtual updates the counters for a transmitted IP packet The source and destination of the packet directly correspond with the source and destination in netlogtype.Connection.

Jump to

Keyboard shortcuts

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