[management merge only unique entries on network map merge (#3277)

This commit is contained in:
Pascal Fischer
2025-02-05 16:50:45 +01:00
committed by GitHub
parent b2a5b29fb2
commit 035c5d9f23
13 changed files with 216 additions and 19 deletions
+25 -1
View File
@@ -1,6 +1,9 @@
package domain
import "strings"
import (
"sort"
"strings"
)
type List []Domain
@@ -60,6 +63,27 @@ func (d List) PunycodeString() string {
return strings.Join(d.ToPunycodeList(), ", ")
}
func (d List) Equal(domains List) bool {
if len(d) != len(domains) {
return false
}
sort.Slice(d, func(i, j int) bool {
return d[i] < d[j]
})
sort.Slice(domains, func(i, j int) bool {
return domains[i] < domains[j]
})
for i, domain := range d {
if domain != domains[i] {
return false
}
}
return true
}
// FromStringList creates a DomainList from a slice of string.
func FromStringList(s []string) (List, error) {
var dl List