chore(updater): set vpn field for all providers
- Bump servers model versions for all providers except mullvad, ivpn, windscribe - Do not leave `vpn` JSON field empty for any server
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -25,6 +26,7 @@ func getPossibleServers() (possibleServers hostToServer) {
|
||||
const domain = "cg-dialup.net"
|
||||
possibleHost := groupID + "-" + countryCode + "." + domain
|
||||
possibleServer := models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Hostname: possibleHost,
|
||||
Country: country,
|
||||
TCP: protocol == constants.TCP,
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/updater/resolver"
|
||||
"github.com/qdm12/gluetun/internal/updater/unzip"
|
||||
@@ -37,6 +38,7 @@ func GetServers(ctx context.Context, unzipper unzip.Unzipper,
|
||||
if len(server.IPs) == 0 {
|
||||
continue
|
||||
}
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.UDP = true // no TCP support
|
||||
servers[i] = server
|
||||
i++
|
||||
|
||||
@@ -3,6 +3,7 @@ package fastestvpn
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ type hostToServer map[string]models.Server
|
||||
func (hts hostToServer) add(host, country string, tcp, udp bool) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Country = country
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/updater/resolver"
|
||||
)
|
||||
@@ -51,6 +52,7 @@ func GetServers(ctx context.Context, client *http.Client,
|
||||
country, region, city := parseOpenvpnURL(url, protocol)
|
||||
|
||||
server := models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Country: country,
|
||||
Region: region,
|
||||
City: city,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net"
|
||||
"sort"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -12,6 +13,7 @@ type hostToServer map[string]models.Server
|
||||
func (hts hostToServer) add(host, country, city string, tcp, udp bool) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Country = country
|
||||
server.City = city
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -28,6 +29,7 @@ func Test_hostToServer_add(t *testing.T) {
|
||||
udp: true,
|
||||
expectedHTS: hostToServer{
|
||||
"host": {
|
||||
VPN: vpn.OpenVPN,
|
||||
Hostname: "host",
|
||||
Country: "country",
|
||||
City: "city",
|
||||
@@ -48,6 +50,7 @@ func Test_hostToServer_add(t *testing.T) {
|
||||
expectedHTS: hostToServer{
|
||||
"existing host": {},
|
||||
"host": models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Hostname: "host",
|
||||
Country: "country",
|
||||
City: "city",
|
||||
@@ -59,6 +62,7 @@ func Test_hostToServer_add(t *testing.T) {
|
||||
"extend existing server": {
|
||||
initialHTS: hostToServer{
|
||||
"host": models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Hostname: "host",
|
||||
Country: "country",
|
||||
City: "city",
|
||||
@@ -72,6 +76,7 @@ func Test_hostToServer_add(t *testing.T) {
|
||||
udp: true,
|
||||
expectedHTS: hostToServer{
|
||||
"host": models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Hostname: "host",
|
||||
Country: "country",
|
||||
City: "city",
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/updater/resolver"
|
||||
"github.com/qdm12/gluetun/internal/updater/resolver/mock_resolver"
|
||||
@@ -110,8 +111,22 @@ func Test_GetServers(t *testing.T) {
|
||||
},
|
||||
resolveWarnings: []string{"resolve warning"},
|
||||
servers: []models.Server{
|
||||
{Country: "Canada", City: "City A", Hostname: "hosta", UDP: true, IPs: []net.IP{{1, 1, 1, 1}, {2, 2, 2, 2}}},
|
||||
{Country: "Luxembourg", City: "City B", Hostname: "hostb", UDP: true, IPs: []net.IP{{3, 3, 3, 3}, {4, 4, 4, 4}}},
|
||||
{
|
||||
VPN: vpn.OpenVPN,
|
||||
Country: "Canada",
|
||||
City: "City A",
|
||||
Hostname: "hosta",
|
||||
UDP: true,
|
||||
IPs: []net.IP{{1, 1, 1, 1}, {2, 2, 2, 2}},
|
||||
},
|
||||
{
|
||||
VPN: vpn.OpenVPN,
|
||||
Country: "Luxembourg",
|
||||
City: "City B",
|
||||
Hostname: "hostb",
|
||||
UDP: true,
|
||||
IPs: []net.IP{{3, 3, 3, 3}, {4, 4, 4, 4}},
|
||||
},
|
||||
},
|
||||
warnings: []string{"resolve warning"},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -45,6 +46,7 @@ func GetServers(ctx context.Context, client *http.Client, minServers int) (
|
||||
}
|
||||
|
||||
server := models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
Region: jsonServer.Country,
|
||||
Hostname: jsonServer.Domain,
|
||||
Number: number,
|
||||
|
||||
@@ -3,6 +3,7 @@ package perfectprivacy
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ type cityToServer map[string]models.Server
|
||||
func (cts cityToServer) add(city string, ips []net.IP) {
|
||||
server, ok := cts[city]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.City = city
|
||||
server.IPs = ips
|
||||
server.TCP = true
|
||||
|
||||
@@ -3,6 +3,7 @@ package pia
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -13,6 +14,7 @@ func (nts nameToServer) add(name, hostname, region string,
|
||||
server, ok := nts[name]
|
||||
if !ok {
|
||||
change = true
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.ServerName = name
|
||||
server.Hostname = hostname
|
||||
server.Region = region
|
||||
|
||||
@@ -3,6 +3,7 @@ package privado
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -13,6 +14,7 @@ func (hts hostToServer) add(host string) {
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.UDP = true
|
||||
hts[host] = server
|
||||
|
||||
@@ -3,6 +3,7 @@ package privatevpn
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -14,6 +15,7 @@ func (hts hostToServer) add(host, country, city string) {
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Country = country
|
||||
server.City = city
|
||||
|
||||
@@ -3,6 +3,7 @@ package protonvpn
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -14,6 +15,7 @@ func (its ipToServer) add(country, region, city, name, hostname string,
|
||||
|
||||
server, ok := its[key]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Country = country
|
||||
server.Region = region
|
||||
server.City = city
|
||||
|
||||
@@ -3,6 +3,7 @@ package purevpn
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ type hostToServer map[string]models.Server
|
||||
func (hts hostToServer) add(host string, tcp, udp bool) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
}
|
||||
if tcp {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -40,6 +41,7 @@ func Test_addServersFromAPI(t *testing.T) {
|
||||
expected: map[string]models.Server{
|
||||
"existinghost": {Hostname: "existinghost"},
|
||||
"host1": {
|
||||
VPN: vpn.OpenVPN,
|
||||
Region: "region1",
|
||||
Country: "country1",
|
||||
City: "location1",
|
||||
@@ -48,6 +50,7 @@ func Test_addServersFromAPI(t *testing.T) {
|
||||
UDP: true,
|
||||
},
|
||||
"host2": {
|
||||
VPN: vpn.OpenVPN,
|
||||
Region: "region2",
|
||||
Country: "country1",
|
||||
City: "location2",
|
||||
|
||||
@@ -3,6 +3,7 @@ package surfshark
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ type hostToServer map[string]models.Server
|
||||
func (hts hostToServer) add(host, region, country, city, retroLoc string, tcp, udp bool) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Region = region
|
||||
server.Country = country
|
||||
|
||||
@@ -3,6 +3,7 @@ package torguard
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -12,6 +13,7 @@ func (hts hostToServer) add(host, country, city string,
|
||||
tcp, udp bool, ips []net.IP) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Country = country
|
||||
server.City = city
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -144,6 +145,7 @@ func getHostToServer() (hts hostToServer, warnings []string) {
|
||||
|
||||
countryCodesMap := constants.CountryCodes()
|
||||
for shortHost, server := range shortHTS {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.UDP = true
|
||||
server.Hostname = shortHost + ".vpnunlimitedapp.com"
|
||||
countryCode := strings.Split(shortHost, "-")[0]
|
||||
|
||||
@@ -3,6 +3,7 @@ package vyprvpn
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ type hostToServer map[string]models.Server
|
||||
func (hts hostToServer) add(host, region string, tcp, udp bool) {
|
||||
server, ok := hts[host]
|
||||
if !ok {
|
||||
server.VPN = vpn.OpenVPN
|
||||
server.Hostname = host
|
||||
server.Region = region
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/updater/resolver"
|
||||
)
|
||||
@@ -44,6 +45,7 @@ func GetServers(ctx context.Context, presolver resolver.Parallel, minServers int
|
||||
for hostname, ips := range hostnameToIPs {
|
||||
city := hostnameToCity[hostname]
|
||||
server := models.Server{
|
||||
VPN: vpn.OpenVPN,
|
||||
City: city,
|
||||
Hostname: hostname,
|
||||
UDP: true,
|
||||
|
||||
Reference in New Issue
Block a user