mirror of
https://github.com/juanfont/headscale.git
synced 2025-02-22 05:22:28 -05:00
use tailscale version in all unsupported errs (#2426)
This commit is contained in:
parent
604f7f6282
commit
bbe57f6cd4
@ -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 {
|
func (ns *noiseServer) earlyNoise(protocolVersion int, writer io.Writer) error {
|
||||||
if !isSupportedVersion(tailcfg.CapabilityVersion(protocolVersion)) {
|
if !isSupportedVersion(tailcfg.CapabilityVersion(protocolVersion)) {
|
||||||
return fmt.Errorf("unsupported client version: %d", protocolVersion)
|
return unsupportedClientError(tailcfg.CapabilityVersion(protocolVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
earlyJSON, err := json.Marshal(&tailcfg.EarlyNoise{
|
earlyJSON, err := json.Marshal(&tailcfg.EarlyNoise{
|
||||||
@ -171,7 +175,7 @@ func rejectUnsupported(
|
|||||||
Str("node_key", nkey.ShortString()).
|
Str("node_key", nkey.ShortString()).
|
||||||
Str("machine_key", mkey.ShortString()).
|
Str("machine_key", mkey.ShortString()).
|
||||||
Msg("unsupported client connected")
|
Msg("unsupported client connected")
|
||||||
http.Error(writer, "unsupported client version", http.StatusBadRequest)
|
http.Error(writer, unsupportedClientError(version).Error(), http.StatusBadRequest)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user