aboutsummaryrefslogtreecommitdiff
path: root/lib/nat/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nat/service.go')
-rw-r--r--lib/nat/service.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/nat/service.go b/lib/nat/service.go
index cc93e933a..8ff66a380 100644
--- a/lib/nat/service.go
+++ b/lib/nat/service.go
@@ -12,6 +12,7 @@ import (
"hash/fnv"
"math/rand"
"net"
+ "slices"
stdsync "sync"
"time"
@@ -411,21 +412,11 @@ func addrSetsEqual(a []Address, b []Address) bool {
return false
}
- // TODO: Rewrite this using slice.Contains once Go 1.21 is the minimum Go version.
- for _, aElem := range a {
- aElemFound := false
- for _, bElem := range b {
- if bElem.Equal(aElem) {
- aElemFound = true
- break
- }
- }
- if !aElemFound {
- // Found element in a that is not in b.
+ for _, v := range a {
+ if !slices.ContainsFunc(b, v.Equal) {
return false
}
}
- // b contains all elements of a and their lengths are equal, so the sets are equal.
return true
}