Maint: make VPN connection not specific to OpenVPN
- Add VPN field to ServerSelection struct - Set VPN type to server selection at start using VPN_TYPE - Change OpenVPNConnection to Connection with Type field - Rename Provider GetOpenVPNConnection to GetConnection - Rename GetTargetIPOpenVPNConnection to GetTargetIPConnection - Rename PickRandomOpenVPNConnection to PickRandomConnection - Add 'OpenVPN' prefix to OpenVPN specific methods on connection
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (c *Cyberghost) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (c *Cyberghost) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 443
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -20,10 +20,11 @@ func (c *Cyberghost) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -33,8 +34,8 @@ func (c *Cyberghost) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, c.randSource), nil
|
||||
return utils.PickRandomConnection(connections, c.randSource), nil
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (c *Cyberghost) BuildConf(connection models.OpenVPNConnection,
|
||||
func (c *Cyberghost) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -48,8 +48,8 @@ func (c *Cyberghost) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (f *Fastestvpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (f *Fastestvpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 4443
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -20,10 +20,11 @@ func (f *Fastestvpn) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -33,8 +34,8 @@ func (f *Fastestvpn) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, f.randSource), nil
|
||||
return utils.PickRandomConnection(connections, f.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (f *Fastestvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (f *Fastestvpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -51,8 +51,8 @@ func (f *Fastestvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (h *HideMyAss) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (h *HideMyAss) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
var port uint16 = 553
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -25,10 +25,11 @@ func (h *HideMyAss) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,8 +39,8 @@ func (h *HideMyAss) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, h.randSource), nil
|
||||
return utils.PickRandomConnection(connections, h.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (h *HideMyAss) BuildConf(connection models.OpenVPNConnection,
|
||||
func (h *HideMyAss) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -42,7 +42,7 @@ func (h *HideMyAss) BuildConf(connection models.OpenVPNConnection,
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
"proto " + connection.Protocol,
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
}
|
||||
|
||||
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
var ErrProtocolUnsupported = errors.New("network protocol is not supported")
|
||||
|
||||
func (i *Ipvanish) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (i *Ipvanish) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 443
|
||||
const protocol = constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -24,10 +24,11 @@ func (i *Ipvanish) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,8 +39,8 @@ func (i *Ipvanish) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, i.randSource), nil
|
||||
return utils.PickRandomConnection(connections, i.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (i *Ipvanish) BuildConf(connection models.OpenVPNConnection,
|
||||
func (i *Ipvanish) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -42,7 +42,7 @@ func (i *Ipvanish) BuildConf(connection models.OpenVPNConnection,
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
"proto " + connection.Protocol,
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"verify-x509-name " + connection.Hostname + " name",
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
var ErrProtocolUnsupported = errors.New("network protocol is not supported")
|
||||
|
||||
func (i *Ivpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (i *Ivpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 2049
|
||||
const protocol = constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -24,10 +24,11 @@ func (i *Ivpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,8 +39,8 @@ func (i *Ivpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, i.randSource), nil
|
||||
return utils.PickRandomConnection(connections, i.randSource), nil
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (i *Ivpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (i *Ivpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -45,7 +45,7 @@ func (i *Ivpn) BuildConf(connection models.OpenVPNConnection,
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
"proto " + connection.Protocol,
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"verify-x509-name " + namePrefix + " name-prefix",
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (m *Mullvad) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (m *Mullvad) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
var port uint16 = 1194
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -25,10 +25,11 @@ func (m *Mullvad) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,8 +39,8 @@ func (m *Mullvad) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, m.randSource), nil
|
||||
return utils.PickRandomConnection(connections, m.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (m *Mullvad) BuildConf(connection models.OpenVPNConnection,
|
||||
func (m *Mullvad) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -42,8 +42,8 @@ func (m *Mullvad) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
}
|
||||
|
||||
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (n *Nordvpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (n *Nordvpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
var port uint16 = 1194
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -21,9 +21,10 @@ func (n *Nordvpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
connections := make([]models.OpenVPNConnection, len(servers))
|
||||
connections := make([]models.Connection, len(servers))
|
||||
for i := range servers {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: servers[i].IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -32,8 +33,8 @@ func (n *Nordvpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, n.randSource), nil
|
||||
return utils.PickRandomConnection(connections, n.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (n *Nordvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (n *Nordvpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -52,8 +52,8 @@ func (n *Nordvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
|
||||
var ErrProtocolUnsupported = errors.New("network protocol is not supported")
|
||||
|
||||
func (p *Privado) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *Privado) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 1194
|
||||
const protocol = constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -25,9 +25,10 @@ func (p *Privado) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
connections := make([]models.OpenVPNConnection, len(servers))
|
||||
connections := make([]models.Connection, len(servers))
|
||||
for i := range servers {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: servers[i].IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -37,8 +38,8 @@ func (p *Privado) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
return utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Privado) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *Privado) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -43,8 +43,8 @@ func (p *Privado) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *PIA) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *PIA) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
protocol = constants.TCP
|
||||
@@ -24,10 +24,11 @@ func (p *PIA) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,9 +39,9 @@ func (p *PIA) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
connection, err = utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
connection, err = utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
} else {
|
||||
connection, err = utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
connection, err = utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *PIA) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
var defaultCipher, defaultAuth, X509CRL, certificate string
|
||||
switch settings.EncPreset {
|
||||
@@ -61,8 +61,8 @@ func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
}
|
||||
|
||||
if settings.Cipher != "" {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Privatevpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *Privatevpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
var port uint16 = 1194
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -21,10 +21,11 @@ func (p *Privatevpn) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, ip := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: ip,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -34,8 +35,8 @@ func (p *Privatevpn) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
return utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Privatevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *Privatevpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES128gcm
|
||||
@@ -40,8 +40,8 @@ func (p *Privatevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Protonvpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *Protonvpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
protocol = constants.TCP
|
||||
@@ -24,9 +24,10 @@ func (p *Protonvpn) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
return connection, err
|
||||
}
|
||||
|
||||
connections := make([]models.OpenVPNConnection, len(servers))
|
||||
connections := make([]models.Connection, len(servers))
|
||||
for i := range servers {
|
||||
connections[i] = models.OpenVPNConnection{
|
||||
connections[i] = models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: servers[i].EntryIP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -34,8 +35,8 @@ func (p *Protonvpn) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
return utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Protonvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *Protonvpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -51,8 +51,8 @@ func (p *Protonvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ import (
|
||||
|
||||
// Provider contains methods to read and modify the openvpn configuration to connect as a client.
|
||||
type Provider interface {
|
||||
GetOpenVPNConnection(selection configuration.ServerSelection) (connection models.OpenVPNConnection, err error)
|
||||
BuildConf(connection models.OpenVPNConnection, settings configuration.OpenVPN) (lines []string)
|
||||
GetConnection(selection configuration.ServerSelection) (connection models.Connection, err error)
|
||||
BuildConf(connection models.Connection, settings configuration.OpenVPN) (lines []string)
|
||||
PortForwarder
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Purevpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *Purevpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
var port uint16 = 53
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -21,10 +21,11 @@ func (p *Purevpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -34,8 +35,8 @@ func (p *Purevpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
return utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Purevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *Purevpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256gcm
|
||||
@@ -44,8 +44,8 @@ func (p *Purevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
}
|
||||
|
||||
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (s *Surfshark) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (s *Surfshark) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
var port uint16 = 1194
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -21,10 +21,11 @@ func (s *Surfshark) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -34,8 +35,8 @@ func (s *Surfshark) GetOpenVPNConnection(selection configuration.ServerSelection
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, s.randSource), nil
|
||||
return utils.PickRandomConnection(connections, s.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (s *Surfshark) BuildConf(connection models.OpenVPNConnection,
|
||||
func (s *Surfshark) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256gcm
|
||||
@@ -53,8 +53,8 @@ func (s *Surfshark) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (t *Torguard) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (t *Torguard) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
protocol = constants.TCP
|
||||
@@ -24,10 +24,11 @@ func (t *Torguard) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -37,8 +38,8 @@ func (t *Torguard) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, t.randSource), nil
|
||||
return utils.PickRandomConnection(connections, t.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (t *Torguard) BuildConf(connection models.OpenVPNConnection,
|
||||
func (t *Torguard) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256gcm
|
||||
@@ -55,8 +55,8 @@ func (t *Torguard) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
func PickRandomOpenVPNConnection(connections []models.OpenVPNConnection,
|
||||
source rand.Source) models.OpenVPNConnection {
|
||||
func PickRandomConnection(connections []models.Connection,
|
||||
source rand.Source) models.Connection {
|
||||
return connections[rand.New(source).Intn(len(connections))] //nolint:gosec
|
||||
}
|
||||
|
||||
@@ -8,19 +8,19 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_PickRandomOpenVPNConnection(t *testing.T) {
|
||||
func Test_PickRandomConnection(t *testing.T) {
|
||||
t.Parallel()
|
||||
connections := []models.OpenVPNConnection{
|
||||
connections := []models.Connection{
|
||||
{Port: 1}, {Port: 2}, {Port: 3}, {Port: 4},
|
||||
}
|
||||
source := rand.NewSource(0)
|
||||
|
||||
connection := PickRandomOpenVPNConnection(connections, source)
|
||||
assert.Equal(t, models.OpenVPNConnection{Port: 3}, connection)
|
||||
connection := PickRandomConnection(connections, source)
|
||||
assert.Equal(t, models.Connection{Port: 3}, connection)
|
||||
|
||||
connection = PickRandomOpenVPNConnection(connections, source)
|
||||
assert.Equal(t, models.OpenVPNConnection{Port: 3}, connection)
|
||||
connection = PickRandomConnection(connections, source)
|
||||
assert.Equal(t, models.Connection{Port: 3}, connection)
|
||||
|
||||
connection = PickRandomOpenVPNConnection(connections, source)
|
||||
assert.Equal(t, models.OpenVPNConnection{Port: 2}, connection)
|
||||
connection = PickRandomConnection(connections, source)
|
||||
assert.Equal(t, models.Connection{Port: 2}, connection)
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
var ErrTargetIPNotFound = errors.New("target IP address not found")
|
||||
|
||||
func GetTargetIPOpenVPNConnection(connections []models.OpenVPNConnection,
|
||||
targetIP net.IP) (connection models.OpenVPNConnection, err error) {
|
||||
func GetTargetIPConnection(connections []models.Connection,
|
||||
targetIP net.IP) (connection models.Connection, err error) {
|
||||
for _, connection := range connections {
|
||||
if targetIP.Equal(connection.IP) {
|
||||
return connection, nil
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
var ErrProtocolUnsupported = errors.New("network protocol is not supported")
|
||||
|
||||
func (p *Provider) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (p *Provider) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 1194
|
||||
const protocol = constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -24,10 +24,11 @@ func (p *Provider) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -37,8 +38,8 @@ func (p *Provider) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, p.randSource), nil
|
||||
return utils.PickRandomConnection(connections, p.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (p *Provider) BuildConf(connection models.OpenVPNConnection,
|
||||
func (p *Provider) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
lines = []string{
|
||||
"client",
|
||||
@@ -35,8 +35,8 @@ func (p *Provider) BuildConf(connection models.OpenVPNConnection,
|
||||
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
}
|
||||
|
||||
if settings.Cipher != "" {
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
|
||||
var ErrProtocolUnsupported = errors.New("network protocol is not supported")
|
||||
|
||||
func (v *Vyprvpn) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (v *Vyprvpn) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
const port = 443
|
||||
const protocol = constants.UDP
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -25,10 +25,11 @@ func (v *Vyprvpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -38,8 +39,8 @@ func (v *Vyprvpn) GetOpenVPNConnection(selection configuration.ServerSelection)
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, v.randSource), nil
|
||||
return utils.PickRandomConnection(connections, v.randSource), nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (v *Vyprvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
func (v *Vyprvpn) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -45,8 +45,8 @@ func (v *Vyprvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (w *Windscribe) GetOpenVPNConnection(selection configuration.ServerSelection) (
|
||||
connection models.OpenVPNConnection, err error) {
|
||||
func (w *Windscribe) GetConnection(selection configuration.ServerSelection) (
|
||||
connection models.Connection, err error) {
|
||||
protocol := constants.UDP
|
||||
var port uint16 = 443
|
||||
if selection.OpenVPN.TCP {
|
||||
@@ -25,10 +25,11 @@ func (w *Windscribe) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
return connection, err
|
||||
}
|
||||
|
||||
var connections []models.OpenVPNConnection
|
||||
var connections []models.Connection
|
||||
for _, server := range servers {
|
||||
for _, IP := range server.IPs {
|
||||
connection := models.OpenVPNConnection{
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: IP,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
@@ -39,8 +40,8 @@ func (w *Windscribe) GetOpenVPNConnection(selection configuration.ServerSelectio
|
||||
}
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
return utils.GetTargetIPOpenVPNConnection(connections, selection.TargetIP)
|
||||
return utils.GetTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
return utils.PickRandomOpenVPNConnection(connections, w.randSource), nil
|
||||
return utils.PickRandomConnection(connections, w.randSource), nil
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
func (w *Windscribe) BuildConf(connection models.OpenVPNConnection,
|
||||
func (w *Windscribe) BuildConf(connection models.Connection,
|
||||
settings configuration.OpenVPN) (lines []string) {
|
||||
if settings.Cipher == "" {
|
||||
settings.Cipher = constants.AES256cbc
|
||||
@@ -47,8 +47,8 @@ func (w *Windscribe) BuildConf(connection models.OpenVPNConnection,
|
||||
// Modified variables
|
||||
"verb " + strconv.Itoa(settings.Verbosity),
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
connection.OpenVPNProtoLine(),
|
||||
connection.OpenVPNRemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
"verify-x509-name " + connection.Hostname + " name",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user