feat(surfshark): Wireguard support (#587)

This commit is contained in:
Quentin McGaw
2022-08-26 10:55:46 -04:00
committed by GitHub
parent 4ace99f318
commit 5989f29035
14 changed files with 2792 additions and 526 deletions

View File

@@ -11,7 +11,7 @@ import (
func (u *Updater) FetchServers(ctx context.Context, minServers int) (
servers []models.Server, err error) {
hts := make(hostToServer)
hts := make(hostToServers)
err = addServersFromAPI(ctx, u.client, hts)
if err != nil {
@@ -37,14 +37,13 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
if err != nil {
return nil, err
}
if len(hostToIPs) < minServers {
return nil, fmt.Errorf("%w: %d and expected at least %d",
common.ErrNotEnoughServers, len(servers), minServers)
}
hts.adaptWithIPs(hostToIPs)
if len(hts) < minServers {
return nil, fmt.Errorf("%w: %d and expected at least %d",
common.ErrNotEnoughServers, len(hts), minServers)
}
servers = hts.toServersSlice()
sort.Sort(models.SortableServers(servers))