86 lines
2.0 KiB
Go
86 lines
2.0 KiB
Go
package windscribe
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
|
|
"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 (w *Windscribe) BuildConf(connection models.OpenVPNConnection,
|
|
username string, settings configuration.OpenVPN) (lines []string) {
|
|
if settings.Cipher == "" {
|
|
settings.Cipher = constants.AES256cbc
|
|
}
|
|
|
|
if settings.Auth == "" {
|
|
settings.Auth = constants.SHA512
|
|
}
|
|
|
|
lines = []string{
|
|
"client",
|
|
"dev tun",
|
|
"nobind",
|
|
"persist-key",
|
|
"remote-cert-tls server",
|
|
"ping 10",
|
|
"ping-exit 60",
|
|
"ping-timer-rem",
|
|
"tls-exit",
|
|
|
|
// Windscribe specific
|
|
"key-direction 1",
|
|
"script-security 2",
|
|
"reneg-sec 0",
|
|
"ncp-disable",
|
|
|
|
// 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(),
|
|
"auth " + settings.Auth,
|
|
"verify-x509-name " + connection.Hostname + " name",
|
|
}
|
|
|
|
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
|
|
|
if strings.HasSuffix(settings.Cipher, "-gcm") {
|
|
lines = append(lines, "ncp-ciphers AES-256-GCM:AES-256-CBC:AES-128-GCM")
|
|
}
|
|
|
|
if !settings.Root {
|
|
lines = append(lines, "user "+username)
|
|
}
|
|
|
|
if settings.MSSFix > 0 {
|
|
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
|
}
|
|
|
|
if settings.Provider.ExtraConfigOptions.OpenVPNIPv6 {
|
|
lines = append(lines, "tun-ipv6")
|
|
} else {
|
|
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
|
lines = append(lines, `pull-filter ignore "ifconfig-ipv6"`)
|
|
}
|
|
|
|
lines = append(lines, utils.WrapOpenvpnCA(
|
|
constants.WindscribeCertificate)...)
|
|
lines = append(lines, utils.WrapOpenvpnTLSAuth(
|
|
constants.WindscribeOpenvpnStaticKeyV1)...)
|
|
|
|
lines = append(lines, "")
|
|
|
|
return lines
|
|
}
|