Просмотр исходного кода

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

Updates #3157

Change-Id: I04accc09783a68257d28cadde5818bf0724a8013
Signed-off-by: Brad Fitzpatrick <[email protected]>
Brad Fitzpatrick 3 лет назад
Родитель
Сommit
c81be7b899
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      control/controlclient/direct.go

+ 6 - 0
control/controlclient/direct.go

@@ -1097,6 +1097,12 @@ func loadServerPubKeys(ctx context.Context, httpc *http.Client, serverURL string
 	var out tailcfg.OverTLSPublicKeyResponse
 	var out tailcfg.OverTLSPublicKeyResponse
 	jsonErr := json.Unmarshal(b, &out)
 	jsonErr := json.Unmarshal(b, &out)
 	if jsonErr == nil {
 	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
 		return &out, nil
 	}
 	}