mirror of
https://github.com/qdm12/gluetun.git
synced 2026-08-06 20:33:44 +02:00
chore(models): common Server & Servers for all providers (#943)
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
type hostToServer map[string]models.TorguardServer
|
||||
type hostToServer map[string]models.Server
|
||||
|
||||
func (hts hostToServer) add(host, country, city string,
|
||||
tcp, udp bool, ips []net.IP) {
|
||||
@@ -50,8 +50,8 @@ func (hts hostToServer) adaptWithIPs(hostToIPs map[string][]net.IP) {
|
||||
}
|
||||
}
|
||||
|
||||
func (hts hostToServer) toServersSlice() (servers []models.TorguardServer) {
|
||||
servers = make([]models.TorguardServer, 0, len(hts))
|
||||
func (hts hostToServer) toServersSlice() (servers []models.Server) {
|
||||
servers = make([]models.Server, 0, len(hts))
|
||||
for _, server := range hts {
|
||||
servers = append(servers, server)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ var ErrNotEnoughServers = errors.New("not enough servers found")
|
||||
|
||||
func GetServers(ctx context.Context, unzipper unzip.Unzipper,
|
||||
presolver resolver.Parallel, minServers int) (
|
||||
servers []models.TorguardServer, warnings []string, err error) {
|
||||
servers []models.Server, warnings []string, err error) {
|
||||
const tcpURL = "https://torguard.net/downloads/OpenVPN-TCP-Linux.zip"
|
||||
tcpContents, err := unzipper.FetchAndExtract(ctx, tcpURL)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
func sortServers(servers []models.TorguardServer) {
|
||||
func sortServers(servers []models.Server) {
|
||||
sort.Slice(servers, func(i, j int) bool {
|
||||
if servers[i].Country == servers[j].Country {
|
||||
if servers[i].City == servers[j].City {
|
||||
|
||||
Reference in New Issue
Block a user