mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-24 09:39:39 +00:00
tailcfg, all: use []netip.AddrPort instead of []string for Endpoints
It's JSON wire compatible. Updates #cleanup Change-Id: Ifa5c17768fec35b305b06d75eb5f0611c8a135a6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
5f5c9142cc
commit
425cf9aa9d
@@ -26,6 +26,13 @@ import (
|
||||
"tailscale.com/wgengine/wgcfg"
|
||||
)
|
||||
|
||||
func epFromTyped(eps []tailcfg.Endpoint) (ret []netip.AddrPort) {
|
||||
for _, ep := range eps {
|
||||
ret = append(ret, ep.Addr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.Prefix) {
|
||||
l1 := logger.WithPrefix(logf, "e1: ")
|
||||
k1 := key.NewNode()
|
||||
@@ -96,17 +103,12 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
|
||||
}
|
||||
logf("e1 status: %v", *st)
|
||||
|
||||
var eps []string
|
||||
for _, ep := range st.LocalAddrs {
|
||||
eps = append(eps, ep.Addr.String())
|
||||
}
|
||||
|
||||
n := &tailcfg.Node{
|
||||
ID: tailcfg.NodeID(0),
|
||||
Name: "n1",
|
||||
Addresses: []netip.Prefix{a1},
|
||||
AllowedIPs: []netip.Prefix{a1},
|
||||
Endpoints: eps,
|
||||
Endpoints: epFromTyped(st.LocalAddrs),
|
||||
}
|
||||
e2.SetNetworkMap(&netmap.NetworkMap{
|
||||
NodeKey: k2.Public(),
|
||||
@@ -133,17 +135,12 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
|
||||
}
|
||||
logf("e2 status: %v", *st)
|
||||
|
||||
var eps []string
|
||||
for _, ep := range st.LocalAddrs {
|
||||
eps = append(eps, ep.Addr.String())
|
||||
}
|
||||
|
||||
n := &tailcfg.Node{
|
||||
ID: tailcfg.NodeID(0),
|
||||
Name: "n2",
|
||||
Addresses: []netip.Prefix{a2},
|
||||
AllowedIPs: []netip.Prefix{a2},
|
||||
Endpoints: eps,
|
||||
Endpoints: epFromTyped(st.LocalAddrs),
|
||||
}
|
||||
e1.SetNetworkMap(&netmap.NetworkMap{
|
||||
NodeKey: k1.Public(),
|
||||
|
||||
Reference in New Issue
Block a user