chore(updater): move updater packages to pkg/updaters/<name>

This commit is contained in:
Quentin McGaw
2026-04-23 03:47:57 +00:00
parent 628b0a22e2
commit d96752c734
164 changed files with 732 additions and 343 deletions
+32
View File
@@ -0,0 +1,32 @@
package mullvad
import (
"net/netip"
"sort"
)
func uniqueSortedIPs(ips []netip.Addr) []netip.Addr {
uniqueIPs := make(map[string]struct{}, len(ips))
for _, ip := range ips {
key := ip.String()
uniqueIPs[key] = struct{}{}
}
ips = make([]netip.Addr, 0, len(uniqueIPs))
for key := range uniqueIPs {
ip, err := netip.ParseAddr(key)
if err != nil {
panic(err)
}
if ip.Is4In6() {
ip = netip.AddrFrom4(ip.As4())
}
ips = append(ips, ip)
}
sort.Slice(ips, func(i, j int) bool {
return ips[i].Compare(ips[j]) < 0
})
return ips
}