From 7e8d5ed6f3ef4a583c21e0b33d667e891e9bfe26 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 1 Nov 2021 18:40:39 -0700 Subject: [PATCH] ipn: use key.NodePublic instead of tailcfg.NodeKey Updates #3206 Signed-off-by: David Anderson --- ipn/backend.go | 3 ++- ipn/ipnlocal/local.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ipn/backend.go b/ipn/backend.go index 1dd301cad..949bf5444 100644 --- a/ipn/backend.go +++ b/ipn/backend.go @@ -12,6 +12,7 @@ import ( "tailscale.com/ipn/ipnstate" "tailscale.com/tailcfg" "tailscale.com/types/empty" + "tailscale.com/types/key" "tailscale.com/types/netmap" "tailscale.com/types/structs" ) @@ -48,7 +49,7 @@ type EngineStatus struct { RBytes, WBytes int64 NumLive int LiveDERPs int // number of active DERP connections - LivePeers map[tailcfg.NodeKey]ipnstate.PeerStatusLite + LivePeers map[key.NodePublic]ipnstate.PeerStatusLite } // Notify is a communication from a backend (e.g. tailscaled) to a frontend diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 1ead7a756..11dab36ae 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1562,14 +1562,14 @@ func (b *LocalBackend) parseWgStatusLocked(s *wgengine.Status) (ret ipn.EngineSt var peerStats, peerKeys strings.Builder ret.LiveDERPs = s.DERPs - ret.LivePeers = map[tailcfg.NodeKey]ipnstate.PeerStatusLite{} + ret.LivePeers = map[key.NodePublic]ipnstate.PeerStatusLite{} for _, p := range s.Peers { if !p.LastHandshake.IsZero() { fmt.Fprintf(&peerStats, "%d/%d ", p.RxBytes, p.TxBytes) fmt.Fprintf(&peerKeys, "%s ", p.NodeKey.ShortString()) ret.NumLive++ - ret.LivePeers[p.NodeKey.AsNodeKey()] = p + ret.LivePeers[p.NodeKey] = p } ret.RBytes += p.RxBytes @@ -2680,7 +2680,7 @@ func (b *LocalBackend) OperatorUserID() string { // TestOnlyPublicKeys returns the current machine and node public // keys. Used in tests only to facilitate automated node authorization // in the test harness. -func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeKey tailcfg.NodeKey) { +func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeKey key.NodePublic) { b.mu.Lock() prefs := b.prefs machinePrivKey := b.machinePrivKey @@ -2692,7 +2692,7 @@ func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeK mk := machinePrivKey.Public() nk := prefs.Persist.PrivateNodeKey.Public() - return mk, nk.AsNodeKey() + return mk, nk } func (b *LocalBackend) WaitingFiles() ([]apitype.WaitingFile, error) {