Documentation
¶
Overview ¶
Package connectiondiag holds shared interpretation for the connection counter API and MCP tools.
Index ¶
- Variables
- func AverageRTTMS(sum, samples uint64) uint32
- func LossPermille(lost, sent uint64) uint32
- func SupportsHysteria2Links2(protocol string, supportsLinks2 bool) bool
- func UnsupportedCounters(protocol string) []string
- func UnsupportedCountersFor(protocol string, agentCaps []string, v Variant) []string
- func UnsupportedCountersForNode(protocol string, agentCaps []string) []string
- func UnsupportedDescription() string
- func UnsupportedKeyCounters(protocol string, agentCaps []string, v Variant) []string
- type Variant
Constants ¶
This section is empty.
Variables ¶
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"} )
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
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
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
SupportsHysteria2Links2 reports whether this protocol/node pair can produce the close and path-quality fields.
func UnsupportedCounters ¶
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 ¶
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
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.
Types ¶
type Variant ¶
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 ¶
VLESSVariant reads the variant from a VLESS profile's settings_json (no secret is in it); anything unreadable is "".