connectiondiag

package
v0.2.2-dev.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 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

Overview

Package connectiondiag holds shared interpretation for the connection counter API and MCP tools.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Link3Fields are the counters of agents that list links/3 (agent.proto LinkCounters from hs_unfinished on).
	Link3Fields = []string{"hs_unfinished", "tls_alerts_sent", "tls_alerts_recv", "tls_cert_refused", "reality_fallback", "auth_failed",
		"tcp_stalls", "tcp_stalls_16k", "initiations", "responses", "responses_unmatched"}
	// KeyLink3Fields are the links/3 counters a key's row can carry (a device row of GetUserConnection).
	KeyLink3Fields = []string{"tcp_stalls", "tcp_stalls_16k", "initiations", "responses", "responses_unmatched"}
)
View Source
var TunnelRefusalFields = []string{"tunnel_blocked", "tunnel_no_ipv4", "tunnel_conn_refused", "tunnel_conn_unreachable", "tunnel_conn_dns",
	"tunnel_conn_other", "tunnel_timeout", "tunnel_other_deadlines", "tunnel_other_authority", "tunnel_other_icmp", "tunnel_other_dial",
	"tunnel_stream_closed", "tunnel_stream_cred_gone", "tunnel_stream_conn_limit"}

TunnelRefusalFields are those counters, in the order of plugin.TunnelRefusal. Only TrustTunnel has them: for another protocol they are zero and left out of the views, and unsupported does not name them.

Functions

func AverageRTTMS added in v0.1.57

func AverageRTTMS(sum, samples uint64) uint32

AverageRTTMS returns the integer mean of the node's smoothed RTT samples, or zero when there were no samples.

func LossPermille added in v0.1.57

func LossPermille(lost, sent uint64) uint32

LossPermille returns packets declared lost per thousand sent, or zero when no packets were sent. The division avoids overflowing uint64 when the aggregate packet count is large.

func SupportsHysteria2Links2 added in v0.1.57

func SupportsHysteria2Links2(protocol string, supportsLinks2 bool) bool

SupportsHysteria2Links2 reports whether this protocol/node pair can produce the close and path-quality fields.

func UnsupportedCounters

func UnsupportedCounters(protocol string) []string

UnsupportedCounters returns protocol-level counters this protocol does not report. A fresh slice keeps callers from mutating shared values. Hysteria2 and VLESS are treated as older agents unless their capability is supplied to UnsupportedCountersForNode.

func UnsupportedCountersFor

func UnsupportedCountersFor(protocol string, agentCaps []string, v Variant) []string

UnsupportedCountersFor also accounts for node-agent capabilities and the inbound's variant. links/2 is the Hysteria2-only close and path-quality contract, vless-unknown-keys/1 enables the VLESS unknown-user-ID counter, and links/3 the handshake-failure reasons each engine can see (agent.proto LinkCounters).

func UnsupportedCountersForNode added in v0.1.57

func UnsupportedCountersForNode(protocol string, agentCaps []string) []string

UnsupportedCountersForNode is UnsupportedCountersFor without a variant: what depends on the backend or the VLESS transport is not known.

func UnsupportedDescription

func UnsupportedDescription() string

UnsupportedDescription is the common note used by MCP descriptions and tests.

func UnsupportedKeyCounters

func UnsupportedKeyCounters(protocol string, agentCaps []string, v Variant) []string

UnsupportedKeyCounters is the part of UnsupportedCountersFor that a key's row (GetUserConnection) can carry.

Types

type Variant

type Variant struct {
	AwgBackend          string
	Security, Transport string
	CDN                 bool
}

Variant is what decides, beyond the protocol and the agent, which counters an inbound can have: the AmneziaWG backend the node last reported ("" = no report yet), and the VLESS security ("reality" or "tls"), transport ("tcp", "xhttp", "ws") and whether it is reached through a CDN. "" means not known, and a counter that depends on it is then not known either.

func VLESSVariant

func VLESSVariant(settingsJSON string) Variant

VLESSVariant reads the variant from a VLESS profile's settings_json (no secret is in it); anything unreadable is "".

Jump to

Keyboard shortcuts

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