From cc7b9b0dff7b8aaab6022122e5cba5251b30e116 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 21 Feb 2020 14:47:05 -0800 Subject: [PATCH] control/controlclient: fix priority of DERP server, add comment --- control/controlclient/direct.go | 2 +- wgengine/magicsock/magicsock.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index 7fd9997dc..380900d86 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -544,7 +544,7 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM c.logf("debug: adding DERP endpoints to all peers") for i := range nm.Peers { peer := &nm.Peers[i] - peer.Endpoints = append(peer.Endpoints, "127.3.3.40:1") + peer.Endpoints = append([]string{"127.3.3.40:1"}, peer.Endpoints...) } } for _, profile := range resp.UserProfiles { diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 33cbefecf..a4dd512db 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -758,7 +758,7 @@ func (c *Conn) LinkChange() { // AddrSet is a set of UDP addresses that implements wireguard/device.Endpoint. type AddrSet struct { publicKey key.Public // peer public key used for DERP communication - addrs []net.UDPAddr // ordered priority list provided by wgengine + addrs []net.UDPAddr // ordered priority list (low to high) provided by wgengine mu sync.Mutex // guards roamAddr and curAddr