control/controlclient: make RegisterRequest go over Noise

Updates #3488

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-03-08 10:53:19 -08:00
committed by Maisem Ali
parent c4f6df47e5
commit 0f37317664
2 changed files with 52 additions and 19 deletions

View File

@ -240,16 +240,17 @@ func (s *Server) ensureKeyPairLocked() {
}
func (s *Server) serveKey(w http.ResponseWriter, r *http.Request) {
noiseKey, legacyKey := s.publicKeys()
_, legacyKey := s.publicKeys()
if r.FormValue("v") == "" {
w.Header().Set("Content-Type", "text/plain")
io.WriteString(w, legacyKey.UntypedHexString())
return
}
w.Header().Set("Content-Type", "application/json")
// TODO(maisem/bradfitz): support noise protocol here.
json.NewEncoder(w).Encode(&tailcfg.OverTLSPublicKeyResponse{
LegacyPublicKey: legacyKey,
PublicKey: noiseKey,
// PublicKey: noiseKey,
})
}