mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-26 20:36:27 +02:00
chore(updater): move updater packages to pkg/updaters/<name>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package surfshark
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/pkg/updaters/providers/surfshark/servers"
|
||||
)
|
||||
|
||||
func getHostInformation(host string, hostnameToLocation map[string]servers.ServerLocation) (
|
||||
data servers.ServerLocation, err error,
|
||||
) {
|
||||
locationData, ok := hostnameToLocation[host]
|
||||
if !ok {
|
||||
return locationData, fmt.Errorf("hostname %s not found in hostname to location mapping", host)
|
||||
}
|
||||
|
||||
return locationData, nil
|
||||
}
|
||||
|
||||
func hostToLocation(locationData []servers.ServerLocation) (
|
||||
hostToLocation map[string]servers.ServerLocation,
|
||||
) {
|
||||
hostToLocation = make(map[string]servers.ServerLocation, len(locationData))
|
||||
for _, data := range locationData {
|
||||
hostToLocation[data.Hostname] = data
|
||||
}
|
||||
return hostToLocation
|
||||
}
|
||||
Reference in New Issue
Block a user