various: remove remaining uses of key.NewPrivate.

Updates #3206

Signed-off-by: David Anderson <danderson@tailscale.com>
danderson/nodekey-delete-old
David Anderson 3 years ago
parent ccd36cb5b1
commit eeb97fd89f

@ -90,7 +90,7 @@ func TestLocalLogLines(t *testing.T) {
TxBytes: 10, TxBytes: 10,
RxBytes: 10, RxBytes: 10,
LastHandshake: time.Now(), LastHandshake: time.Now(),
NodeKey: tailcfg.NodeKey(key.NewPrivate()), NodeKey: tailcfg.NodeKeyFromNodePublic(key.NewNode().Public()),
}}, }},
}) })
lb.mu.Unlock() lb.mu.Unlock()
@ -105,7 +105,7 @@ func TestLocalLogLines(t *testing.T) {
TxBytes: 11, TxBytes: 11,
RxBytes: 12, RxBytes: 12,
LastHandshake: time.Now(), LastHandshake: time.Now(),
NodeKey: tailcfg.NodeKey(key.NewPrivate()), NodeKey: tailcfg.NodeKeyFromNodePublic(key.NewNode().Public()),
}}, }},
}) })
lb.mu.Unlock() lb.mu.Unlock()

@ -274,9 +274,9 @@ func (s *Server) AddFakeNode() {
if s.nodes == nil { if s.nodes == nil {
s.nodes = make(map[tailcfg.NodeKey]*tailcfg.Node) s.nodes = make(map[tailcfg.NodeKey]*tailcfg.Node)
} }
nk := tailcfg.NodeKey(key.NewPrivate().Public()) nk := tailcfg.NodeKeyFromNodePublic(key.NewNode().Public())
mk := key.NewMachine().Public() mk := key.NewMachine().Public()
dk := tailcfg.DiscoKey(key.NewPrivate().Public()) dk := tailcfg.DiscoKeyFromDiscoPublic(key.NewDisco().Public())
id := int64(binary.LittleEndian.Uint64(nk[:])) id := int64(binary.LittleEndian.Uint64(nk[:]))
ip := netaddr.IPv4(nk[0], nk[1], nk[2], nk[3]) ip := netaddr.IPv4(nk[0], nk[1], nk[2], nk[3])
addr := netaddr.IPPrefixFrom(ip, 32) addr := netaddr.IPPrefixFrom(ip, 32)

@ -1136,7 +1136,7 @@ func TestDiscoMessage(t *testing.T) {
peer1Pub := c.DiscoPublicKey() peer1Pub := c.DiscoPublicKey()
peer1Priv := c.discoPrivate peer1Priv := c.discoPrivate
n := &tailcfg.Node{ n := &tailcfg.Node{
Key: tailcfg.NodeKey(key.NewPrivate().Public()), Key: tailcfg.NodeKeyFromNodePublic(key.NewNode().Public()),
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(peer1Pub), DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(peer1Pub),
} }
c.peerMap.upsertEndpoint(&endpoint{ c.peerMap.upsertEndpoint(&endpoint{

@ -45,7 +45,7 @@ func TestNoteReceiveActivity(t *testing.T) {
} }
ra := e.recvActivityAt ra := e.recvActivityAt
nk := tailcfg.NodeKey(key.NewPrivate().Public()) nk := tailcfg.NodeKeyFromNodePublic(key.NewNode().Public())
// Activity on an untracked key should do nothing. // Activity on an untracked key should do nothing.
e.noteRecvActivity(nk) e.noteRecvActivity(nk)

Loading…
Cancel
Save