Maintenance: OpenVPN BuildConf arity reduced
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/firewall"
|
||||
gluetunLog "github.com/qdm12/gluetun/internal/logging"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/settings"
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/golibs/os"
|
||||
)
|
||||
@@ -109,11 +110,11 @@ func (p *pia) GetOpenVPNConnection(selection models.ServerSelection) (
|
||||
return connection, nil
|
||||
}
|
||||
|
||||
func (p *pia) BuildConf(connection models.OpenVPNConnection, verbosity int, username string, root bool,
|
||||
cipher, auth string, extras models.ExtraConfigOptions) (lines []string) {
|
||||
func (p *pia) BuildConf(connection models.OpenVPNConnection,
|
||||
username string, settings settings.OpenVPN) (lines []string) {
|
||||
var X509CRL, certificate string
|
||||
var defaultCipher, defaultAuth string
|
||||
if extras.EncryptionPreset == constants.PIAEncryptionPresetNormal {
|
||||
if settings.Provider.ExtraConfigOptions.EncryptionPreset == constants.PIAEncryptionPresetNormal {
|
||||
defaultCipher = "aes-128-cbc"
|
||||
defaultAuth = "sha1"
|
||||
X509CRL = constants.PiaX509CRLNormal
|
||||
@@ -124,11 +125,11 @@ func (p *pia) BuildConf(connection models.OpenVPNConnection, verbosity int, user
|
||||
X509CRL = constants.PiaX509CRLStrong
|
||||
certificate = constants.PIACertificateStrong
|
||||
}
|
||||
if len(cipher) == 0 {
|
||||
cipher = defaultCipher
|
||||
if len(settings.Cipher) == 0 {
|
||||
settings.Cipher = defaultCipher
|
||||
}
|
||||
if len(auth) == 0 {
|
||||
auth = defaultAuth
|
||||
if len(settings.Auth) == 0 {
|
||||
settings.Auth = defaultAuth
|
||||
}
|
||||
lines = []string{
|
||||
"client",
|
||||
@@ -150,17 +151,17 @@ func (p *pia) BuildConf(connection models.OpenVPNConnection, verbosity int, user
|
||||
"suppress-timestamps",
|
||||
|
||||
// Modified variables
|
||||
fmt.Sprintf("verb %d", verbosity),
|
||||
fmt.Sprintf("verb %d", settings.Verbosity),
|
||||
fmt.Sprintf("auth-user-pass %s", constants.OpenVPNAuthConf),
|
||||
fmt.Sprintf("proto %s", connection.Protocol),
|
||||
fmt.Sprintf("remote %s %d", connection.IP, connection.Port),
|
||||
fmt.Sprintf("cipher %s", cipher),
|
||||
fmt.Sprintf("auth %s", auth),
|
||||
fmt.Sprintf("cipher %s", settings.Cipher),
|
||||
fmt.Sprintf("auth %s", settings.Auth),
|
||||
}
|
||||
if strings.HasSuffix(cipher, "-gcm") {
|
||||
if strings.HasSuffix(settings.Cipher, "-gcm") {
|
||||
lines = append(lines, "ncp-disable")
|
||||
}
|
||||
if !root {
|
||||
if !settings.Root {
|
||||
lines = append(lines, "user "+username)
|
||||
}
|
||||
lines = append(lines, []string{
|
||||
|
||||
Reference in New Issue
Block a user