mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
wgengine/magicsock: remove test uses of wgkey.
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
7c40a5d440
commit
e03fda7ae6
@ -41,7 +41,6 @@ import (
|
|||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
"tailscale.com/types/nettype"
|
"tailscale.com/types/nettype"
|
||||||
"tailscale.com/types/wgkey"
|
|
||||||
"tailscale.com/util/cibuild"
|
"tailscale.com/util/cibuild"
|
||||||
"tailscale.com/util/racebuild"
|
"tailscale.com/util/racebuild"
|
||||||
"tailscale.com/wgengine/filter"
|
"tailscale.com/wgengine/filter"
|
||||||
@ -1234,23 +1233,24 @@ func addTestEndpoint(tb testing.TB, conn *Conn, sendConn net.PacketConn) (tailcf
|
|||||||
// valid peer and not fall through to the legacy magicsock
|
// valid peer and not fall through to the legacy magicsock
|
||||||
// codepath.
|
// codepath.
|
||||||
discoKey := tailcfg.DiscoKey{31: 1}
|
discoKey := tailcfg.DiscoKey{31: 1}
|
||||||
nodeKey := tailcfg.NodeKey{0: 'N', 1: 'K'}
|
nodeKey := key.NodePublicFromRaw32(mem.B([]byte{0: 'N', 1: 'K', 31: 0}))
|
||||||
|
tnk := tailcfg.NodeKeyFromNodePublic(nodeKey)
|
||||||
conn.SetNetworkMap(&netmap.NetworkMap{
|
conn.SetNetworkMap(&netmap.NetworkMap{
|
||||||
Peers: []*tailcfg.Node{
|
Peers: []*tailcfg.Node{
|
||||||
{
|
{
|
||||||
Key: nodeKey,
|
Key: tnk,
|
||||||
DiscoKey: discoKey,
|
DiscoKey: discoKey,
|
||||||
Endpoints: []string{sendConn.LocalAddr().String()},
|
Endpoints: []string{sendConn.LocalAddr().String()},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
conn.SetPrivateKey(key.NodePrivateFromRaw32(mem.B([]byte{0: 1, 31: 0})))
|
conn.SetPrivateKey(key.NodePrivateFromRaw32(mem.B([]byte{0: 1, 31: 0})))
|
||||||
_, err := conn.ParseEndpoint(wgkey.Key(nodeKey).HexString())
|
_, err := conn.ParseEndpoint(nodeKey.UntypedHexString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tb.Fatal(err)
|
tb.Fatal(err)
|
||||||
}
|
}
|
||||||
conn.addValidDiscoPathForTest(nodeKey, netaddr.MustParseIPPort(sendConn.LocalAddr().String()))
|
conn.addValidDiscoPathForTest(tnk, netaddr.MustParseIPPort(sendConn.LocalAddr().String()))
|
||||||
return nodeKey, discoKey
|
return tnk, discoKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func setUpReceiveFrom(tb testing.TB) (roundTrip func()) {
|
func setUpReceiveFrom(tb testing.TB) (roundTrip func()) {
|
||||||
@ -1422,7 +1422,7 @@ func TestSetNetworkMapChangingNodeKey(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
_, err := conn.ParseEndpoint(wgkey.Key(nodeKey1).HexString())
|
_, err := conn.ParseEndpoint(key.NodePublicFromRaw32(mem.B(nodeKey1[:])).UntypedHexString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user