Fix surfshark updater and update server data
This commit is contained in:
@@ -7,15 +7,18 @@ import (
|
||||
)
|
||||
|
||||
func uniqueSortedIPs(ips []net.IP) []net.IP {
|
||||
uniqueIPs := make(map[string]struct{})
|
||||
uniqueIPs := make(map[string]struct{}, len(ips))
|
||||
for _, ip := range ips {
|
||||
uniqueIPs[ip.String()] = struct{}{}
|
||||
key := ip.String()
|
||||
uniqueIPs[key] = struct{}{}
|
||||
}
|
||||
ips = make([]net.IP, len(uniqueIPs))
|
||||
i := 0
|
||||
for ip := range uniqueIPs {
|
||||
ips[i] = net.ParseIP(ip)
|
||||
i++
|
||||
ips = make([]net.IP, 0, len(uniqueIPs))
|
||||
for key := range uniqueIPs {
|
||||
ip := net.ParseIP(key)
|
||||
if ipv4 := ip.To4(); ipv4 != nil {
|
||||
ip = ipv4
|
||||
}
|
||||
ips = append(ips, ip)
|
||||
}
|
||||
sort.Slice(ips, func(i, j int) bool {
|
||||
return bytes.Compare(ips[i], ips[j]) < 0
|
||||
|
||||
Reference in New Issue
Block a user