ipn/ipnlocal, net/dns: use slices.Equal to simplify code (#16641)

Signed-off-by: jishudashu <979260390@qq.com>
This commit is contained in:
jishudashu
2025-08-01 02:36:51 +08:00
committed by GitHub
parent 47b5f10165
commit 23a0398136
2 changed files with 3 additions and 26 deletions

View File

@@ -8,6 +8,7 @@ import (
"bufio"
"fmt"
"net/netip"
"slices"
"sort"
"tailscale.com/control/controlknobs"
@@ -181,19 +182,7 @@ func sameResolverNames(a, b []*dnstype.Resolver) bool {
if a[i].Addr != b[i].Addr {
return false
}
if !sameIPs(a[i].BootstrapResolution, b[i].BootstrapResolution) {
return false
}
}
return true
}
func sameIPs(a, b []netip.Addr) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
if !slices.Equal(a[i].BootstrapResolution, b[i].BootstrapResolution) {
return false
}
}