mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-06 04:42:42 +00:00
all: add Node.HomeDERP int, phase out "127.3.3.40:$region" hack [capver 111]
This deprecates the old "DERP string" packing a DERP region ID into an IP:port of 127.3.3.40:$REGION_ID and just uses an integer, like PeerChange.DERPRegion does. We still support servers sending the old form; they're converted to the new form internally right when they're read off the network. Updates #14636 Change-Id: I9427ec071f02a2c6d75ccb0fcbf0ecff9f19f26f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
66269dc934
commit
2fc4455e6d
@@ -1007,8 +1007,8 @@ func TestUpdateNetmapDelta(t *testing.T) {
|
||||
|
||||
wants := []*tailcfg.Node{
|
||||
{
|
||||
ID: 1,
|
||||
DERP: "127.3.3.40:1",
|
||||
ID: 1,
|
||||
HomeDERP: 1,
|
||||
},
|
||||
{
|
||||
ID: 2,
|
||||
@@ -2021,7 +2021,7 @@ func TestAutoExitNodeSetNetInfoCallback(t *testing.T) {
|
||||
netip.MustParsePrefix("100.64.1.1/32"),
|
||||
netip.MustParsePrefix("fe70::1/128"),
|
||||
},
|
||||
DERP: "127.3.3.40:2",
|
||||
HomeDERP: 2,
|
||||
}
|
||||
defaultDERPMap := &tailcfg.DERPMap{
|
||||
Regions: map[int]*tailcfg.DERPRegion{
|
||||
@@ -2985,7 +2985,7 @@ func makePeer(id tailcfg.NodeID, opts ...peerOptFunc) tailcfg.NodeView {
|
||||
ID: id,
|
||||
StableID: tailcfg.StableNodeID(fmt.Sprintf("stable%d", id)),
|
||||
Name: fmt.Sprintf("peer%d", id),
|
||||
DERP: fmt.Sprintf("127.3.3.40:%d", id),
|
||||
HomeDERP: int(id),
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(node)
|
||||
@@ -3001,13 +3001,13 @@ func withName(name string) peerOptFunc {
|
||||
|
||||
func withDERP(region int) peerOptFunc {
|
||||
return func(n *tailcfg.Node) {
|
||||
n.DERP = fmt.Sprintf("127.3.3.40:%d", region)
|
||||
n.HomeDERP = region
|
||||
}
|
||||
}
|
||||
|
||||
func withoutDERP() peerOptFunc {
|
||||
return func(n *tailcfg.Node) {
|
||||
n.DERP = ""
|
||||
n.HomeDERP = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user