- Pass min servers to resolve call - Set settings when constructing resolver - Construct resolver in each provider updater - No more common resolver for all providers
30 lines
656 B
Go
30 lines
656 B
Go
// Package cyberghost contains code to obtain the server information
|
|
// for the Cyberghost provider.
|
|
package cyberghost
|
|
|
|
import (
|
|
"context"
|
|
"sort"
|
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
)
|
|
|
|
func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
|
servers []models.Server, err error) {
|
|
possibleServers := getPossibleServers()
|
|
|
|
possibleHosts := possibleServers.hostsSlice()
|
|
hostToIPs, _, err := u.presolver.Resolve(ctx, possibleHosts, minServers)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
possibleServers.adaptWithIPs(hostToIPs)
|
|
|
|
servers = possibleServers.toSlice()
|
|
|
|
sort.Sort(models.SortableServers(servers))
|
|
|
|
return servers, nil
|
|
}
|