74 lines
1.9 KiB
Go
74 lines
1.9 KiB
Go
package fastestvpn
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration"
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
|
)
|
|
|
|
func (f *Fastestvpn) BuildConf(connection models.OpenVPNConnection,
|
|
username string, settings configuration.OpenVPN) (lines []string) {
|
|
if settings.Cipher == "" {
|
|
settings.Cipher = constants.AES256cbc
|
|
}
|
|
if settings.Auth == "" {
|
|
settings.Auth = constants.SHA256
|
|
}
|
|
if settings.MSSFix == 0 {
|
|
settings.MSSFix = 1450
|
|
}
|
|
|
|
lines = []string{
|
|
"client",
|
|
"dev tun",
|
|
"nobind",
|
|
"persist-key",
|
|
"ping 15",
|
|
"ping-exit 60",
|
|
"ping-timer-rem",
|
|
"tls-exit",
|
|
|
|
// Fastestvpn specific
|
|
"ping-restart 0",
|
|
"tls-client",
|
|
"tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-RSA-WITH-AES-256-CBC-SHA", //nolint:lll
|
|
"comp-lzo",
|
|
"key-direction 1",
|
|
"tun-mtu 1500",
|
|
"tun-mtu-extra 32",
|
|
"mssfix " + strconv.Itoa(int(settings.MSSFix)), // defaults to 1450
|
|
|
|
// Added constant values
|
|
"auth-nocache",
|
|
"mute-replay-warnings",
|
|
"pull-filter ignore \"auth-token\"", // prevent auth failed loops
|
|
"auth-retry nointeract",
|
|
"suppress-timestamps",
|
|
|
|
// Modified variables
|
|
"verb " + strconv.Itoa(settings.Verbosity),
|
|
"auth-user-pass " + constants.OpenVPNAuthConf,
|
|
connection.ProtoLine(),
|
|
connection.RemoteLine(),
|
|
"data-ciphers-fallback " + settings.Cipher,
|
|
"data-ciphers " + settings.Cipher,
|
|
"auth " + settings.Auth,
|
|
}
|
|
|
|
if !settings.Root {
|
|
lines = append(lines, "user "+username)
|
|
}
|
|
|
|
lines = append(lines, utils.WrapOpenvpnCA(
|
|
constants.FastestvpnCertificate)...)
|
|
lines = append(lines, utils.WrapOpenvpnTLSAuth(
|
|
constants.FastestvpnOpenvpnStaticKeyV1)...)
|
|
|
|
lines = append(lines, "")
|
|
|
|
return lines
|
|
}
|