@ -38,7 +38,6 @@ import (
"go4.org/mem"
"go4.org/mem"
"go4.org/netipx"
"go4.org/netipx"
xmaps "golang.org/x/exp/maps"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/net/dns/dnsmessage"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip"
"tailscale.com/appc"
"tailscale.com/appc"
@ -104,6 +103,7 @@ import (
"tailscale.com/util/osuser"
"tailscale.com/util/osuser"
"tailscale.com/util/rands"
"tailscale.com/util/rands"
"tailscale.com/util/set"
"tailscale.com/util/set"
"tailscale.com/util/slicesx"
"tailscale.com/util/syspolicy"
"tailscale.com/util/syspolicy"
"tailscale.com/util/syspolicy/rsop"
"tailscale.com/util/syspolicy/rsop"
"tailscale.com/util/systemd"
"tailscale.com/util/systemd"
@ -2022,7 +2022,7 @@ func (b *LocalBackend) DisablePortMapperForTest() {
func ( b * LocalBackend ) PeersForTest ( ) [ ] tailcfg . NodeView {
func ( b * LocalBackend ) PeersForTest ( ) [ ] tailcfg . NodeView {
b . mu . Lock ( )
b . mu . Lock ( )
defer b . mu . Unlock ( )
defer b . mu . Unlock ( )
ret := xmaps . Values( b . peers )
ret := slices x. Map Values( b . peers )
slices . SortFunc ( ret , func ( a , b tailcfg . NodeView ) int {
slices . SortFunc ( ret , func ( a , b tailcfg . NodeView ) int {
return cmp . Compare ( a . ID ( ) , b . ID ( ) )
return cmp . Compare ( a . ID ( ) , b . ID ( ) )
} )
} )
@ -7375,9 +7375,9 @@ func suggestExitNode(report *netcheck.Report, netMap *netmap.NetworkMap, prevSug
// First, try to select an exit node that has the closest DERP home, based on lastReport's DERP latency.
// First, try to select an exit node that has the closest DERP home, based on lastReport's DERP latency.
// If there are no latency values, it returns an arbitrary region
// If there are no latency values, it returns an arbitrary region
if len ( candidatesByRegion ) > 0 {
if len ( candidatesByRegion ) > 0 {
minRegion := minLatencyDERPRegion ( xmaps . Keys( candidatesByRegion ) , report )
minRegion := minLatencyDERPRegion ( slices x. Map Keys( candidatesByRegion ) , report )
if minRegion == 0 {
if minRegion == 0 {
minRegion = selectRegion ( views . SliceOf ( xmaps . Keys( candidatesByRegion ) ) )
minRegion = selectRegion ( views . SliceOf ( slices x. Map Keys( candidatesByRegion ) ) )
}
}
regionCandidates , ok := candidatesByRegion [ minRegion ]
regionCandidates , ok := candidatesByRegion [ minRegion ]
if ! ok {
if ! ok {
@ -7636,5 +7636,5 @@ func vipServicesFromPrefs(prefs ipn.PrefsView) []*tailcfg.VIPService {
services [ s ] . Active = true
services [ s ] . Active = true
}
}
return slices . Collect ( maps . Values ( services ) )
return slices x. MapValues ( services )
}
}