chore(storage): common sorting for all servers

This commit is contained in:
Quentin McGaw
2022-06-06 01:57:44 +00:00
parent f53f0cfffd
commit 1216326867
48 changed files with 1319 additions and 1795 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/url"
"sort"
"strings"
"github.com/qdm12/gluetun/internal/models"
@@ -46,7 +47,7 @@ func (u *Updater) GetServers(ctx context.Context, minServers int) (
servers = cts.toServersSlice()
sortServers(servers)
sort.Sort(models.SortableServers(servers))
return servers, nil
}

View File

@@ -1,13 +0,0 @@
package perfectprivacy
import (
"sort"
"github.com/qdm12/gluetun/internal/models"
)
func sortServers(servers []models.Server) {
sort.Slice(servers, func(i, j int) bool {
return servers[i].City < servers[j].City
})
}