use tailscale version in all unsupported errs (#2426)

This commit is contained in:
Kristoffer Dalby 2025-02-14 13:43:33 +01:00 committed by GitHub
parent 604f7f6282
commit bbe57f6cd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}