From bbe57f6cd4b5fa92dbd6967c23e2554be29eecf1 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 14 Feb 2025 13:43:33 +0100 Subject: [PATCH] use tailscale version in all unsupported errs (#2426) --- hscontrol/noise.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hscontrol/noise.go b/hscontrol/noise.go index 034b2d1f..ebd178a7 100644 --- a/hscontrol/noise.go +++ b/hscontrol/noise.go @@ -116,9 +116,13 @@ func (h *Headscale) NoiseUpgradeHandler( ) } +func unsupportedClientError(version tailcfg.CapabilityVersion) error { + return fmt.Errorf("unsupported client version: %s (%d)", capver.TailscaleVersion(version), version) +} + func (ns *noiseServer) earlyNoise(protocolVersion int, writer io.Writer) error { if !isSupportedVersion(tailcfg.CapabilityVersion(protocolVersion)) { - return fmt.Errorf("unsupported client version: %d", protocolVersion) + return unsupportedClientError(tailcfg.CapabilityVersion(protocolVersion)) } earlyJSON, err := json.Marshal(&tailcfg.EarlyNoise{ @@ -171,7 +175,7 @@ func rejectUnsupported( Str("node_key", nkey.ShortString()). Str("machine_key", mkey.ShortString()). Msg("unsupported client connected") - http.Error(writer, "unsupported client version", http.StatusBadRequest) + http.Error(writer, unsupportedClientError(version).Error(), http.StatusBadRequest) return true }