chore(constants): internal/constants/providers

- New package to avoid package import cycles
This commit is contained in:
Quentin McGaw
2022-04-16 19:30:26 +00:00
parent ad80e0c1ab
commit 54b7e23974
51 changed files with 335 additions and 339 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
)
@@ -42,7 +43,7 @@ func Test_modifyConfig(t *testing.T) {
ProcessUser: "procuser",
Interface: "tun3",
Verbosity: intPtr(0),
}.WithDefaults(constants.Custom),
}.WithDefaults(providers.Custom),
connection: models.Connection{
IP: net.IPv4(1, 2, 3, 4),
Port: 1194,

View File

@@ -1,7 +1,7 @@
package custom
import (
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/openvpn/extract"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -14,6 +14,6 @@ type Provider struct {
func New() *Provider {
return &Provider{
extractor: extract.New(),
NoPortForwarder: utils.NewNoPortForwarding(constants.Custom),
NoPortForwarder: utils.NewNoPortForwarding(providers.Custom),
}
}

View File

@@ -5,7 +5,7 @@ import (
"testing"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -22,7 +22,7 @@ func Test_Cyberghost_filterServers(t *testing.T) {
err error
}{
"no server": {
selection: settings.ServerSelection{}.WithDefaults(constants.Cyberghost),
selection: settings.ServerSelection{}.WithDefaults(providers.Cyberghost),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"servers without filter defaults to UDP": {
@@ -32,7 +32,7 @@ func Test_Cyberghost_filterServers(t *testing.T) {
{Country: "c", UDP: true},
{Country: "d", UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Cyberghost),
selection: settings.ServerSelection{}.WithDefaults(providers.Cyberghost),
filteredServers: []models.CyberghostServer{
{Country: "c", UDP: true},
{Country: "d", UDP: true},
@@ -49,7 +49,7 @@ func Test_Cyberghost_filterServers(t *testing.T) {
OpenVPN: settings.OpenVPNSelection{
TCP: boolPtr(true),
},
}.WithDefaults(constants.Cyberghost),
}.WithDefaults(providers.Cyberghost),
filteredServers: []models.CyberghostServer{
{Country: "a", TCP: true},
{Country: "b", TCP: true},
@@ -64,7 +64,7 @@ func Test_Cyberghost_filterServers(t *testing.T) {
},
selection: settings.ServerSelection{
Countries: []string{"a", "c"},
}.WithDefaults(constants.Cyberghost),
}.WithDefaults(providers.Cyberghost),
filteredServers: []models.CyberghostServer{
{Country: "a", UDP: true},
{Country: "c", UDP: true},
@@ -78,7 +78,7 @@ func Test_Cyberghost_filterServers(t *testing.T) {
},
selection: settings.ServerSelection{
Hostnames: []string{"a", "c"},
}.WithDefaults(constants.Cyberghost),
}.WithDefaults(providers.Cyberghost),
filteredServers: []models.CyberghostServer{
{Hostname: "a", UDP: true},
{Hostname: "c", UDP: true},

View File

@@ -3,7 +3,7 @@ package cyberghost
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.CyberghostServer, randSource rand.Source) *Cyberghost
return &Cyberghost{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Cyberghost),
NoPortForwarder: utils.NewNoPortForwarding(providers.Cyberghost),
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -23,7 +24,7 @@ func Test_Provider_GetConnection(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Expressvpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Expressvpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -32,7 +33,7 @@ func Test_Provider_GetConnection(t *testing.T) {
{IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},
{IPs: []net.IP{net.IPv4(3, 3, 3, 3)}, UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Expressvpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Expressvpn),
connection: models.Connection{
Type: constants.OpenVPN,
IP: net.IPv4(1, 1, 1, 1),
@@ -43,7 +44,7 @@ func Test_Provider_GetConnection(t *testing.T) {
"target IP": {
selection: settings.ServerSelection{
TargetIP: net.IPv4(2, 2, 2, 2),
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{IPs: []net.IP{net.IPv4(1, 1, 1, 1)}, UDP: true},
{IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},
@@ -59,7 +60,7 @@ func Test_Provider_GetConnection(t *testing.T) {
"with filter": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{Hostname: "a", IPs: []net.IP{net.IPv4(1, 1, 1, 1)}, UDP: true},
{Hostname: "b", IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},

View File

@@ -6,7 +6,7 @@ import (
"testing"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -24,7 +24,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Expressvpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Expressvpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -33,7 +33,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
{Hostname: "b", UDP: true},
{Hostname: "c", UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Expressvpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Expressvpn),
filtered: []models.ExpressvpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},
@@ -43,7 +43,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
"filter by country": {
selection: settings.ServerSelection{
Countries: []string{"b"},
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{Country: "a", UDP: true},
{Country: "b", UDP: true},
@@ -56,7 +56,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{City: "a", UDP: true},
{City: "b", UDP: true},
@@ -69,7 +69,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},
@@ -84,7 +84,7 @@ func Test_Expressvpn_filterServers(t *testing.T) {
OpenVPN: settings.OpenVPNSelection{
TCP: boolPtr(true),
},
}.WithDefaults(constants.Expressvpn),
}.WithDefaults(providers.Expressvpn),
servers: []models.ExpressvpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true, TCP: true},

View File

@@ -3,7 +3,7 @@ package expressvpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.ExpressvpnServer, randSource rand.Source) *Provider {
return &Provider{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Expressvpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Expressvpn),
}
}

View File

@@ -3,7 +3,7 @@ package fastestvpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.FastestvpnServer, randSource rand.Source) *Fastestvpn
return &Fastestvpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Fastestvpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Fastestvpn),
}
}

View File

@@ -3,7 +3,7 @@ package hidemyass
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.HideMyAssServer, randSource rand.Source) *HideMyAss {
return &HideMyAss{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.HideMyAss),
NoPortForwarder: utils.NewNoPortForwarding(providers.HideMyAss),
}
}

View File

@@ -3,7 +3,7 @@ package ipvanish
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.IpvanishServer, randSource rand.Source) *Ipvanish {
return &Ipvanish{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Ipvanish),
NoPortForwarder: utils.NewNoPortForwarding(providers.Ipvanish),
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -23,7 +24,7 @@ func Test_Ivpn_GetConnection(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Ivpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Ivpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -32,7 +33,7 @@ func Test_Ivpn_GetConnection(t *testing.T) {
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(3, 3, 3, 3)}, UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Ivpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Ivpn),
connection: models.Connection{
Type: constants.OpenVPN,
IP: net.IPv4(1, 1, 1, 1),
@@ -43,7 +44,7 @@ func Test_Ivpn_GetConnection(t *testing.T) {
"target IP": {
selection: settings.ServerSelection{
TargetIP: net.IPv4(2, 2, 2, 2),
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(1, 1, 1, 1)}, UDP: true},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},
@@ -59,7 +60,7 @@ func Test_Ivpn_GetConnection(t *testing.T) {
"with filter": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, Hostname: "a", IPs: []net.IP{net.IPv4(1, 1, 1, 1)}, UDP: true},
{VPN: constants.OpenVPN, Hostname: "b", IPs: []net.IP{net.IPv4(2, 2, 2, 2)}, UDP: true},

View File

@@ -7,6 +7,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -24,7 +25,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Ivpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Ivpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -33,7 +34,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
{VPN: constants.OpenVPN, Hostname: "b", UDP: true},
{VPN: constants.OpenVPN, Hostname: "c", UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Ivpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Ivpn),
filtered: []models.IvpnServer{
{VPN: constants.OpenVPN, Hostname: "a", UDP: true},
{VPN: constants.OpenVPN, Hostname: "b", UDP: true},
@@ -43,7 +44,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
"filter by country": {
selection: settings.ServerSelection{
Countries: []string{"b"},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, Country: "a", UDP: true},
{VPN: constants.OpenVPN, Country: "b", UDP: true},
@@ -56,7 +57,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, City: "a", UDP: true},
{VPN: constants.OpenVPN, City: "b", UDP: true},
@@ -69,7 +70,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
"filter by ISP": {
selection: settings.ServerSelection{
ISPs: []string{"b"},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, ISP: "a", UDP: true},
{VPN: constants.OpenVPN, ISP: "b", UDP: true},
@@ -82,7 +83,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, Hostname: "a", UDP: true},
{VPN: constants.OpenVPN, Hostname: "b", UDP: true},
@@ -97,7 +98,7 @@ func Test_Ivpn_filterServers(t *testing.T) {
OpenVPN: settings.OpenVPNSelection{
TCP: boolPtr(true),
},
}.WithDefaults(constants.Ivpn),
}.WithDefaults(providers.Ivpn),
servers: []models.IvpnServer{
{VPN: constants.OpenVPN, Hostname: "a", UDP: true},
{VPN: constants.OpenVPN, Hostname: "b", UDP: true, TCP: true},

View File

@@ -3,7 +3,7 @@ package ivpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.IvpnServer, randSource rand.Source) *Ivpn {
return &Ivpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Ivpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Ivpn),
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -23,7 +24,7 @@ func Test_Mullvad_GetConnection(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Mullvad),
selection: settings.ServerSelection{}.WithDefaults(providers.Mullvad),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -32,7 +33,7 @@ func Test_Mullvad_GetConnection(t *testing.T) {
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(3, 3, 3, 3)}},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Mullvad),
selection: settings.ServerSelection{}.WithDefaults(providers.Mullvad),
connection: models.Connection{
Type: constants.OpenVPN,
IP: net.IPv4(1, 1, 1, 1),
@@ -43,7 +44,7 @@ func Test_Mullvad_GetConnection(t *testing.T) {
"target IP": {
selection: settings.ServerSelection{
TargetIP: net.IPv4(2, 2, 2, 2),
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
@@ -59,7 +60,7 @@ func Test_Mullvad_GetConnection(t *testing.T) {
"with filter": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, Hostname: "a", IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{VPN: constants.OpenVPN, Hostname: "b", IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},

View File

@@ -7,6 +7,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -24,7 +25,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Mullvad),
selection: settings.ServerSelection{}.WithDefaults(providers.Mullvad),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -33,7 +34,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
{VPN: constants.OpenVPN, Hostname: "b"},
{VPN: constants.OpenVPN, Hostname: "c"},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Mullvad),
selection: settings.ServerSelection{}.WithDefaults(providers.Mullvad),
filtered: []models.MullvadServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.OpenVPN, Hostname: "b"},
@@ -43,7 +44,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter OpenVPN out": {
selection: settings.ServerSelection{
VPN: constants.Wireguard,
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.Wireguard, Hostname: "b"},
@@ -56,7 +57,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter by country": {
selection: settings.ServerSelection{
Countries: []string{"b"},
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, Country: "a"},
{VPN: constants.OpenVPN, Country: "b"},
@@ -69,7 +70,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, City: "a"},
{VPN: constants.OpenVPN, City: "b"},
@@ -82,7 +83,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter by ISP": {
selection: settings.ServerSelection{
ISPs: []string{"b"},
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, ISP: "a"},
{VPN: constants.OpenVPN, ISP: "b"},
@@ -95,7 +96,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.OpenVPN, Hostname: "b"},
@@ -108,7 +109,7 @@ func Test_Mullvad_filterServers(t *testing.T) {
"filter by owned": {
selection: settings.ServerSelection{
OwnedOnly: boolPtr(true),
}.WithDefaults(constants.Mullvad),
}.WithDefaults(providers.Mullvad),
servers: []models.MullvadServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.OpenVPN, Hostname: "b", Owned: true},

View File

@@ -3,7 +3,7 @@ package mullvad
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.MullvadServer, randSource rand.Source) *Mullvad {
return &Mullvad{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Mullvad),
NoPortForwarder: utils.NewNoPortForwarding(providers.Mullvad),
}
}

View File

@@ -3,7 +3,7 @@ package nordvpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.NordvpnServer, randSource rand.Source) *Nordvpn {
return &Nordvpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Nordvpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Nordvpn),
}
}

View File

@@ -3,7 +3,7 @@ package perfectprivacy
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.PerfectprivacyServer, randSource rand.Source) *Perfect
return &Perfectprivacy{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Perfectprivacy),
NoPortForwarder: utils.NewNoPortForwarding(providers.Perfectprivacy),
}
}

View File

@@ -3,7 +3,7 @@ package privado
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.PrivadoServer, randSource rand.Source) *Privado {
return &Privado{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Privado),
NoPortForwarder: utils.NewNoPortForwarding(providers.Privado),
}
}

View File

@@ -3,7 +3,7 @@ package privatevpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.PrivatevpnServer, randSource rand.Source) *Privatevpn
return &Privatevpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Privatevpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Privatevpn),
}
}

View File

@@ -3,7 +3,7 @@ package protonvpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.ProtonvpnServer, randSource rand.Source) *Protonvpn {
return &Protonvpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Protonvpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Protonvpn),
}
}

View File

@@ -9,7 +9,7 @@ import (
"time"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/custom"
"github.com/qdm12/gluetun/internal/provider/cyberghost"
@@ -53,47 +53,47 @@ type PortForwarder interface {
func New(provider string, allServers models.AllServers, timeNow func() time.Time) Provider {
randSource := rand.NewSource(timeNow().UnixNano())
switch provider {
case constants.Custom:
case providers.Custom:
return custom.New()
case constants.Cyberghost:
case providers.Cyberghost:
return cyberghost.New(allServers.Cyberghost.Servers, randSource)
case constants.Expressvpn:
case providers.Expressvpn:
return expressvpn.New(allServers.Expressvpn.Servers, randSource)
case constants.Fastestvpn:
case providers.Fastestvpn:
return fastestvpn.New(allServers.Fastestvpn.Servers, randSource)
case constants.HideMyAss:
case providers.HideMyAss:
return hidemyass.New(allServers.HideMyAss.Servers, randSource)
case constants.Ipvanish:
case providers.Ipvanish:
return ipvanish.New(allServers.Ipvanish.Servers, randSource)
case constants.Ivpn:
case providers.Ivpn:
return ivpn.New(allServers.Ivpn.Servers, randSource)
case constants.Mullvad:
case providers.Mullvad:
return mullvad.New(allServers.Mullvad.Servers, randSource)
case constants.Nordvpn:
case providers.Nordvpn:
return nordvpn.New(allServers.Nordvpn.Servers, randSource)
case constants.Perfectprivacy:
case providers.Perfectprivacy:
return perfectprivacy.New(allServers.Perfectprivacy.Servers, randSource)
case constants.Privado:
case providers.Privado:
return privado.New(allServers.Privado.Servers, randSource)
case constants.PrivateInternetAccess:
case providers.PrivateInternetAccess:
return privateinternetaccess.New(allServers.Pia.Servers, randSource, timeNow)
case constants.Privatevpn:
case providers.Privatevpn:
return privatevpn.New(allServers.Privatevpn.Servers, randSource)
case constants.Protonvpn:
case providers.Protonvpn:
return protonvpn.New(allServers.Protonvpn.Servers, randSource)
case constants.Purevpn:
case providers.Purevpn:
return purevpn.New(allServers.Purevpn.Servers, randSource)
case constants.Surfshark:
case providers.Surfshark:
return surfshark.New(allServers.Surfshark.Servers, randSource)
case constants.Torguard:
case providers.Torguard:
return torguard.New(allServers.Torguard.Servers, randSource)
case constants.VPNUnlimited:
case providers.VPNUnlimited:
return vpnunlimited.New(allServers.VPNUnlimited.Servers, randSource)
case constants.Vyprvpn:
case providers.Vyprvpn:
return vyprvpn.New(allServers.Vyprvpn.Servers, randSource)
case constants.Wevpn:
case providers.Wevpn:
return wevpn.New(allServers.Wevpn.Servers, randSource)
case constants.Windscribe:
case providers.Windscribe:
return windscribe.New(allServers.Windscribe.Servers, randSource)
default:
panic("provider " + provider + " is unknown") // should never occur

View File

@@ -3,7 +3,7 @@ package purevpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.PurevpnServer, randSource rand.Source) *Purevpn {
return &Purevpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Purevpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Purevpn),
}
}

View File

@@ -6,7 +6,7 @@ import (
"testing"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -24,7 +24,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Surfshark),
selection: settings.ServerSelection{}.WithDefaults(providers.Surfshark),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -33,7 +33,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
{Hostname: "b", UDP: true},
{Hostname: "c", UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Surfshark),
selection: settings.ServerSelection{}.WithDefaults(providers.Surfshark),
filtered: []models.SurfsharkServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},
@@ -43,7 +43,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
"filter by region": {
selection: settings.ServerSelection{
Regions: []string{"b"},
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{Region: "a", UDP: true},
{Region: "b", UDP: true},
@@ -56,7 +56,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
"filter by country": {
selection: settings.ServerSelection{
Countries: []string{"b"},
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{Country: "a", UDP: true},
{Country: "b", UDP: true},
@@ -69,7 +69,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{City: "a", UDP: true},
{City: "b", UDP: true},
@@ -82,7 +82,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},
@@ -97,7 +97,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
OpenVPN: settings.OpenVPNSelection{
TCP: boolPtr(true),
},
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true, TCP: true},
@@ -110,7 +110,7 @@ func Test_Surfshark_filterServers(t *testing.T) {
"filter by multihop only": {
selection: settings.ServerSelection{
MultiHopOnly: boolPtr(true),
}.WithDefaults(constants.Surfshark),
}.WithDefaults(providers.Surfshark),
servers: []models.SurfsharkServer{
{Hostname: "a", UDP: true},
{Hostname: "b", MultiHop: true, UDP: true},

View File

@@ -3,7 +3,7 @@ package surfshark
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.SurfsharkServer, randSource rand.Source) *Surfshark {
return &Surfshark{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Surfshark),
NoPortForwarder: utils.NewNoPortForwarding(providers.Surfshark),
}
}

View File

@@ -3,7 +3,7 @@ package torguard
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.TorguardServer, randSource rand.Source) *Torguard {
return &Torguard{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Torguard),
NoPortForwarder: utils.NewNoPortForwarding(providers.Torguard),
}
}

View File

@@ -3,7 +3,7 @@ package vpnunlimited
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.VPNUnlimitedServer, randSource rand.Source) *Provider
return &Provider{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.VPNUnlimited),
NoPortForwarder: utils.NewNoPortForwarding(providers.VPNUnlimited),
}
}

View File

@@ -3,7 +3,7 @@ package vyprvpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.VyprvpnServer, randSource rand.Source) *Vyprvpn {
return &Vyprvpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Vyprvpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Vyprvpn),
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -25,7 +26,7 @@ func Test_Wevpn_GetConnection(t *testing.T) {
"no server available": {
selection: settings.ServerSelection{
VPN: constants.OpenVPN,
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -34,7 +35,7 @@ func Test_Wevpn_GetConnection(t *testing.T) {
{UDP: true, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
{UDP: true, IPs: []net.IP{net.IPv4(3, 3, 3, 3)}},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Wevpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Wevpn),
connection: models.Connection{
Type: constants.OpenVPN,
IP: net.IPv4(1, 1, 1, 1),
@@ -45,7 +46,7 @@ func Test_Wevpn_GetConnection(t *testing.T) {
"target IP": {
selection: settings.ServerSelection{
TargetIP: net.IPv4(2, 2, 2, 2),
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
servers: []models.WevpnServer{
{UDP: true, IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{UDP: true, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
@@ -61,7 +62,7 @@ func Test_Wevpn_GetConnection(t *testing.T) {
"with filter": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
servers: []models.WevpnServer{
{UDP: true, Hostname: "a", IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{UDP: true, Hostname: "b", IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},

View File

@@ -6,7 +6,7 @@ import (
"testing"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -24,7 +24,7 @@ func Test_Wevpn_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Wevpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Wevpn),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -33,7 +33,7 @@ func Test_Wevpn_filterServers(t *testing.T) {
{Hostname: "b", UDP: true},
{Hostname: "c", UDP: true},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Wevpn),
selection: settings.ServerSelection{}.WithDefaults(providers.Wevpn),
filtered: []models.WevpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},
@@ -43,7 +43,7 @@ func Test_Wevpn_filterServers(t *testing.T) {
"filter by protocol": {
selection: settings.ServerSelection{
OpenVPN: settings.OpenVPNSelection{TCP: boolPtr(true)},
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
servers: []models.WevpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", TCP: true},
@@ -56,7 +56,7 @@ func Test_Wevpn_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
servers: []models.WevpnServer{
{City: "a", UDP: true},
{City: "b", UDP: true},
@@ -69,7 +69,7 @@ func Test_Wevpn_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Wevpn),
}.WithDefaults(providers.Wevpn),
servers: []models.WevpnServer{
{Hostname: "a", UDP: true},
{Hostname: "b", UDP: true},

View File

@@ -3,7 +3,7 @@ package wevpn
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.WevpnServer, randSource rand.Source) *Wevpn {
return &Wevpn{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Wevpn),
NoPortForwarder: utils.NewNoPortForwarding(providers.Wevpn),
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -23,7 +24,7 @@ func Test_Windscribe_GetConnection(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Windscribe),
selection: settings.ServerSelection{}.WithDefaults(providers.Windscribe),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -32,7 +33,7 @@ func Test_Windscribe_GetConnection(t *testing.T) {
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(3, 3, 3, 3)}},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Windscribe),
selection: settings.ServerSelection{}.WithDefaults(providers.Windscribe),
connection: models.Connection{
Type: constants.OpenVPN,
IP: net.IPv4(1, 1, 1, 1),
@@ -43,7 +44,7 @@ func Test_Windscribe_GetConnection(t *testing.T) {
"target IP": {
selection: settings.ServerSelection{
TargetIP: net.IPv4(2, 2, 2, 2),
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{VPN: constants.OpenVPN, IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},
@@ -59,7 +60,7 @@ func Test_Windscribe_GetConnection(t *testing.T) {
"with filter": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, Hostname: "a", IPs: []net.IP{net.IPv4(1, 1, 1, 1)}},
{VPN: constants.OpenVPN, Hostname: "b", IPs: []net.IP{net.IPv4(2, 2, 2, 2)}},

View File

@@ -7,6 +7,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -22,7 +23,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
err error
}{
"no server available": {
selection: settings.ServerSelection{}.WithDefaults(constants.Windscribe),
selection: settings.ServerSelection{}.WithDefaults(providers.Windscribe),
err: errors.New("no server found: for VPN openvpn; protocol udp"),
},
"no filter": {
@@ -31,7 +32,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
{VPN: constants.OpenVPN, Hostname: "b"},
{VPN: constants.OpenVPN, Hostname: "c"},
},
selection: settings.ServerSelection{}.WithDefaults(constants.Windscribe),
selection: settings.ServerSelection{}.WithDefaults(providers.Windscribe),
filtered: []models.WindscribeServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.OpenVPN, Hostname: "b"},
@@ -41,7 +42,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
"filter OpenVPN out": {
selection: settings.ServerSelection{
VPN: constants.Wireguard,
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.Wireguard, Hostname: "b"},
@@ -54,7 +55,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
"filter by region": {
selection: settings.ServerSelection{
Regions: []string{"b"},
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, Region: "a"},
{VPN: constants.OpenVPN, Region: "b"},
@@ -67,7 +68,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
"filter by city": {
selection: settings.ServerSelection{
Cities: []string{"b"},
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, City: "a"},
{VPN: constants.OpenVPN, City: "b"},
@@ -80,7 +81,7 @@ func Test_Windscribe_filterServers(t *testing.T) {
"filter by hostname": {
selection: settings.ServerSelection{
Hostnames: []string{"b"},
}.WithDefaults(constants.Windscribe),
}.WithDefaults(providers.Windscribe),
servers: []models.WindscribeServer{
{VPN: constants.OpenVPN, Hostname: "a"},
{VPN: constants.OpenVPN, Hostname: "b"},

View File

@@ -3,7 +3,7 @@ package windscribe
import (
"math/rand"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -18,6 +18,6 @@ func New(servers []models.WindscribeServer, randSource rand.Source) *Windscribe
return &Windscribe{
servers: servers,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(constants.Windscribe),
NoPortForwarder: utils.NewNoPortForwarding(providers.Windscribe),
}
}