all: replace tailcfg.DiscoKey with key.DiscoPublic.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
f771327f0c
commit
0532eb30db
@@ -2269,7 +2269,7 @@ func (c *Conn) SetNetworkMap(nm *netmap.NetworkMap) {
|
||||
endpointState: map[netaddr.IPPort]*endpointState{},
|
||||
}
|
||||
if !n.DiscoKey.IsZero() {
|
||||
ep.discoKey = key.DiscoPublicFromRaw32(mem.B(n.DiscoKey[:]))
|
||||
ep.discoKey = n.DiscoKey
|
||||
ep.discoShort = n.DiscoKey.ShortString()
|
||||
}
|
||||
ep.wgEndpoint = n.Key.UntypedHexString()
|
||||
@@ -3609,10 +3609,9 @@ func (de *endpoint) updateFromNode(n *tailcfg.Node) {
|
||||
de.mu.Lock()
|
||||
defer de.mu.Unlock()
|
||||
|
||||
tnk := key.DiscoPublicFromRaw32(mem.B(n.DiscoKey[:]))
|
||||
if de.discoKey != tnk {
|
||||
if de.discoKey != n.DiscoKey {
|
||||
de.c.logf("[v1] magicsock: disco: node %s changed from discokey %s to %s", de.publicKey.ShortString(), de.discoKey, n.DiscoKey)
|
||||
de.discoKey = tnk
|
||||
de.discoKey = n.DiscoKey
|
||||
de.discoShort = de.discoKey.ShortString()
|
||||
de.resetLocked()
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ func meshStacks(logf logger.Logf, mutateNetmap func(idx int, nm *netmap.NetworkM
|
||||
ID: tailcfg.NodeID(i + 1),
|
||||
Name: fmt.Sprintf("node%d", i+1),
|
||||
Key: peer.privateKey.Public(),
|
||||
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(peer.conn.DiscoPublicKey()),
|
||||
DiscoKey: peer.conn.DiscoPublicKey(),
|
||||
Addresses: addrs,
|
||||
AllowedIPs: addrs,
|
||||
Endpoints: epStrings(eps[i]),
|
||||
@@ -618,7 +618,7 @@ func TestNoDiscoKey(t *testing.T) {
|
||||
|
||||
removeDisco := func(idx int, nm *netmap.NetworkMap) {
|
||||
for _, p := range nm.Peers {
|
||||
p.DiscoKey = tailcfg.DiscoKey{}
|
||||
p.DiscoKey = key.DiscoPublic{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ func TestDiscokeyChange(t *testing.T) {
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
nm.Peers[0].DiscoKey = tailcfg.DiscoKeyFromDiscoPublic(m1DiscoKey)
|
||||
nm.Peers[0].DiscoKey = m1DiscoKey
|
||||
}
|
||||
|
||||
cleanupMesh := meshStacks(t.Logf, setm1Key, m1, m2)
|
||||
@@ -1137,11 +1137,11 @@ func TestDiscoMessage(t *testing.T) {
|
||||
peer1Priv := c.discoPrivate
|
||||
n := &tailcfg.Node{
|
||||
Key: key.NewNode().Public(),
|
||||
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(peer1Pub),
|
||||
DiscoKey: peer1Pub,
|
||||
}
|
||||
c.peerMap.upsertEndpoint(&endpoint{
|
||||
publicKey: n.Key,
|
||||
discoKey: key.DiscoPublicFromRaw32(mem.B(n.DiscoKey[:])),
|
||||
discoKey: n.DiscoKey,
|
||||
})
|
||||
|
||||
const payload = "why hello"
|
||||
@@ -1233,7 +1233,7 @@ func addTestEndpoint(tb testing.TB, conn *Conn, sendConn net.PacketConn) (key.No
|
||||
Peers: []*tailcfg.Node{
|
||||
{
|
||||
Key: nodeKey,
|
||||
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(discoKey),
|
||||
DiscoKey: discoKey,
|
||||
Endpoints: []string{sendConn.LocalAddr().String()},
|
||||
},
|
||||
},
|
||||
@@ -1411,7 +1411,7 @@ func TestSetNetworkMapChangingNodeKey(t *testing.T) {
|
||||
Peers: []*tailcfg.Node{
|
||||
{
|
||||
Key: nodeKey1,
|
||||
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(discoKey),
|
||||
DiscoKey: discoKey,
|
||||
Endpoints: []string{"192.168.1.2:345"},
|
||||
},
|
||||
},
|
||||
@@ -1426,7 +1426,7 @@ func TestSetNetworkMapChangingNodeKey(t *testing.T) {
|
||||
Peers: []*tailcfg.Node{
|
||||
{
|
||||
Key: nodeKey2,
|
||||
DiscoKey: tailcfg.DiscoKeyFromDiscoPublic(discoKey),
|
||||
DiscoKey: discoKey,
|
||||
Endpoints: []string{"192.168.1.2:345"},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user