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..6abc63695 100644 --- a/tailcfg/derpmap.go +++ b/tailcfg/derpmap.go @@ -55,6 +55,12 @@ 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. + // Clients already using this region as their home should migrate + // away to a new region without Avoid set. + 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