From d29feaef79587092b89e8efaa2221620b5c08683 Mon Sep 17 00:00:00 2001 From: Andrey Bobelev Date: Wed, 14 May 2025 15:24:40 +0300 Subject: [PATCH] chore(derp): allow nil regions in DERPMaps Previously, nil regions were not properly handled. This change allows users to disable regions in DERPMaps. Particularly useful to disable some official regions. --- hscontrol/derp/derp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hscontrol/derp/derp.go b/hscontrol/derp/derp.go index 839de9b5..479bfe5c 100644 --- a/hscontrol/derp/derp.go +++ b/hscontrol/derp/derp.go @@ -82,6 +82,12 @@ func mergeDERPMaps(derpMaps []*tailcfg.DERPMap) *tailcfg.DERPMap { maps.Copy(result.Regions, derpMap.Regions) } + for id, region := range result.Regions { + if region == nil { + delete(result.Regions, id) + } + } + return &result }