Servers updater (#232)

* Support for all VPN providers
* Update all VPN providers servers information
* Remove old tooling binaries
This commit is contained in:
Quentin McGaw
2020-09-05 12:57:16 -04:00
committed by GitHub
parent 9dcc00900e
commit 797fa33971
30 changed files with 4028 additions and 3818 deletions

24
internal/updater/ips.go Normal file
View File

@@ -0,0 +1,24 @@
package updater
import (
"bytes"
"net"
"sort"
)
func uniqueSortedIPs(ips []net.IP) []net.IP {
uniqueIPs := make(map[string]struct{})
for _, ip := range ips {
uniqueIPs[ip.String()] = struct{}{}
}
ips = make([]net.IP, len(uniqueIPs))
i := 0
for ip := range uniqueIPs {
ips[i] = net.ParseIP(ip)
i++
}
sort.Slice(ips, func(i, j int) bool {
return bytes.Compare(ips[i], ips[j]) < 0
})
return ips
}