Documentation
¶
Overview ¶
Package connstats maintains statistics about connections flowing through a TUN device (which operate at the IP layer).
Index ¶
- type Statistics
- func (s *Statistics) Extract() (virtual, physical map[netlogtype.Connection]netlogtype.Counts)
- func (s *Statistics) UpdateRxPhysical(src netip.Addr, dst netip.AddrPort, n int)
- func (s *Statistics) UpdateRxVirtual(b []byte)
- func (s *Statistics) UpdateTxPhysical(src netip.Addr, dst netip.AddrPort, n int)
- func (s *Statistics) UpdateTxVirtual(b []byte)
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 ¶
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 ¶
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.