- Each provider interface can now fetch updated servers data - Rename each provider updater subpackage name to `updater` - Updater constructor does not take a settings struct - Updater update method takes in a slice of provider strings
20 lines
434 B
Go
20 lines
434 B
Go
package updater
|
|
|
|
func getUniqueHosts(tcpHostToURL, udpHostToURL map[string]string) (
|
|
hosts []string) {
|
|
uniqueHosts := make(map[string]struct{}, len(tcpHostToURL))
|
|
for host := range tcpHostToURL {
|
|
uniqueHosts[host] = struct{}{}
|
|
}
|
|
for host := range udpHostToURL {
|
|
uniqueHosts[host] = struct{}{}
|
|
}
|
|
|
|
hosts = make([]string, 0, len(uniqueHosts))
|
|
for host := range uniqueHosts {
|
|
hosts = append(hosts, host)
|
|
}
|
|
|
|
return hosts
|
|
}
|