control/controlclient: avoid Noise protocol for js/wasm for now

Updates #3157

Change-Id: I04accc09783a68257d28cadde5818bf0724a8013
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-05-20 09:17:25 -07:00 committed by Brad Fitzpatrick
parent 36af49ae7f
commit c81be7b899

View File

@ -1097,6 +1097,12 @@ func loadServerPubKeys(ctx context.Context, httpc *http.Client, serverURL string
var out tailcfg.OverTLSPublicKeyResponse
jsonErr := json.Unmarshal(b, &out)
if jsonErr == nil {
if runtime.GOOS == "js" {
// As of 2022-05-20 it's not possible for js/wasm to make a bidi
// Noise connection to the control plane. Instead, for now, pretend
// like the server can't do Noise to force use of the old protocol.
out.PublicKey = key.MachinePublic{}
}
return &out, nil
}