use stdlib maps.Values (#1843)

* use stdlib maps.Values

This has been in stdlib since go1.23, no need to use golang.org/x/exp
anymore just for this:

- https://pkg.go.dev/maps#Values

* use slices.AppendSeq to match old behavior
This commit is contained in:
Wade Simmons
2026-08-18 14:49:41 -04:00
committed by GitHub
parent 5cbf029d06
commit 6740518403
3 changed files with 3 additions and 5 deletions
+3 -2
View File
@@ -6,11 +6,13 @@ package router
import (
"context"
"fmt"
"maps"
"net/netip"
"os"
"path/filepath"
"reflect"
"regexp"
"slices"
"sort"
"sync"
"sync/atomic"
@@ -22,7 +24,6 @@ import (
"github.com/slackhq/nebula"
"github.com/slackhq/nebula/header"
"github.com/slackhq/nebula/udp"
"golang.org/x/exp/maps"
)
// outNatKey is the (from, to) pair used by outNat. Comparable struct, so it works as a map key without the
@@ -374,7 +375,7 @@ func (r *R) RenderHostmaps(title string, controls ...*nebula.Control) {
}
func (r *R) renderHostmaps(title string) {
c := maps.Values(r.controls)
c := slices.AppendSeq(make([]*nebula.Control, 0, len(r.controls)), maps.Values(r.controls))
sort.SliceStable(c, func(i, j int) bool {
return c[i].GetVpnAddrs()[0].Compare(c[j].GetVpnAddrs()[0]) > 0
})