diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2021-03-12 10:34:20 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2021-03-12 10:37:06 -0800 |
| commit | 99f953ffae2a7560c9b4cea8707f7638eba0363a (patch) | |
| tree | 8bfa93b1a331394005ebcae1920de0f9230b94db | |
| parent | c81814e4f850a14d0225903b0e2d936bd4950ed9 (diff) | |
| download | tailscale-bradfitz/derp_steer.tar.xz tailscale-bradfitz/derp_steer.zip | |
tailcfg, net/netcheck: let control mark "Avoid" bit on DERP regionsbradfitz/derp_steer
So a region can be used if needed, but won't be STUN-probed or used as
its home.
This gives us another possible debugging mechanism for #1310, or can
be used as a short-term measure against DERP flip-flops for people
equidistant between regions if our hysteresis still isn't good enough.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
| -rw-r--r-- | net/netcheck/netcheck.go | 3 | ||||
| -rw-r--r-- | tailcfg/derpmap.go | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index db50aac6d..9398a1c2c 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -305,6 +305,9 @@ type probePlan map[string][]probe func sortRegions(dm *tailcfg.DERPMap, last *Report) (prev []*tailcfg.DERPRegion) { prev = make([]*tailcfg.DERPRegion, 0, len(dm.Regions)) for _, reg := range dm.Regions { + if reg.Avoid { + continue + } prev = append(prev, reg) } sort.Slice(prev, func(i, j int) bool { diff --git a/tailcfg/derpmap.go b/tailcfg/derpmap.go index 832358b91..5547a2ec8 100644 --- a/tailcfg/derpmap.go +++ b/tailcfg/derpmap.go @@ -55,6 +55,10 @@ type DERPRegion struct { // "San Francisco", "Singapore", "Frankfurt", etc. RegionName string + // Avoid is whether the client should avoid picking this as its home + // region. The region should only be used if a peer is there. + Avoid bool `json:",omitempty"` + // Nodes are the DERP nodes running in this region, in // priority order for the current client. Client TLS // connections should ideally only go to the first entry |
