Maint: refactor VPN configuration structure
- Paves the way for Wireguard - VPN struct contains Type, Openvpn and Provider configurations - OpenVPN specific options (e.g. client key) moved from Provider to Openvpn configuration struct - Move Provider configuration from OpenVPN configuration to VPN - HTTP control server returns only openvpn settings (not provider settings)
This commit is contained in:
@@ -71,7 +71,7 @@ func (c *Cyberghost) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
@@ -81,9 +81,9 @@ func (c *Cyberghost) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, utils.WrapOpenvpnCA(
|
||||
constants.CyberghostCertificate)...)
|
||||
lines = append(lines, utils.WrapOpenvpnCert(
|
||||
settings.Provider.ExtraConfigOptions.ClientCertificate)...)
|
||||
settings.ClientCrt)...)
|
||||
lines = append(lines, utils.WrapOpenvpnKey(
|
||||
settings.Provider.ExtraConfigOptions.ClientKey)...)
|
||||
settings.ClientKey)...)
|
||||
|
||||
lines = append(lines, "")
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ func (f *Fastestvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -59,7 +59,7 @@ func (h *HideMyAss) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -57,7 +57,7 @@ func (i *Ipvanish) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -63,7 +63,7 @@ func (i *Ivpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -56,7 +56,7 @@ func (m *Mullvad) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "fast-io")
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
@@ -71,7 +71,7 @@ func (m *Mullvad) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -67,7 +67,7 @@ func (n *Nordvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -58,7 +58,7 @@ func (p *Privado) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
username string, settings configuration.OpenVPN) (lines []string) {
|
||||
var defaultCipher, defaultAuth, X509CRL, certificate string
|
||||
switch settings.Provider.ExtraConfigOptions.EncryptionPreset {
|
||||
switch settings.EncPreset {
|
||||
case constants.PIAEncryptionPresetNormal:
|
||||
defaultCipher = constants.AES128cbc
|
||||
defaultAuth = constants.SHA1
|
||||
@@ -81,7 +81,7 @@ func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -59,7 +59,7 @@ func (p *Privatevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -66,7 +66,7 @@ func (p *Protonvpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -66,7 +66,7 @@ func (p *Purevpn) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -64,7 +64,7 @@ func (s *Surfshark) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -70,7 +70,7 @@ func (t *Torguard) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "fast-io")
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
@@ -55,7 +55,7 @@ func (p *Provider) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
@@ -65,9 +65,9 @@ func (p *Provider) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, utils.WrapOpenvpnCA(
|
||||
constants.VPNUnlimitedCertificateAuthority)...)
|
||||
lines = append(lines, utils.WrapOpenvpnCert(
|
||||
settings.Provider.ExtraConfigOptions.ClientCertificate)...)
|
||||
settings.ClientCrt)...)
|
||||
lines = append(lines, utils.WrapOpenvpnKey(
|
||||
settings.Provider.ExtraConfigOptions.ClientKey)...)
|
||||
settings.ClientKey)...)
|
||||
|
||||
lines = append(lines, "")
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (w *Windscribe) BuildConf(connection models.OpenVPNConnection,
|
||||
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
||||
}
|
||||
|
||||
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
||||
if settings.IPv6 {
|
||||
lines = append(lines, "tun-ipv6")
|
||||
} else {
|
||||
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
||||
|
||||
Reference in New Issue
Block a user