2021-05-11 17:10:51 +00:00
|
|
|
package windscribe
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strconv"
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2021-05-11 17:10:51 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-19 14:09:41 +00:00
|
|
|
func (w *Windscribe) BuildConf(connection models.Connection,
|
2022-01-06 06:40:23 -05:00
|
|
|
settings settings.OpenVPN) (lines []string, err error) {
|
2021-10-05 20:36:23 +00:00
|
|
|
if len(settings.Ciphers) == 0 {
|
|
|
|
|
settings.Ciphers = []string{
|
|
|
|
|
constants.AES256gcm,
|
|
|
|
|
constants.AES256cbc,
|
|
|
|
|
constants.AES128gcm,
|
|
|
|
|
}
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
auth := *settings.Auth
|
|
|
|
|
if auth == "" {
|
|
|
|
|
auth = constants.SHA512
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lines = []string{
|
|
|
|
|
"client",
|
|
|
|
|
"nobind",
|
|
|
|
|
"tls-exit",
|
2021-09-14 15:46:40 +00:00
|
|
|
"dev " + settings.Interface,
|
2022-01-06 06:40:23 -05:00
|
|
|
"verb " + strconv.Itoa(*settings.Verbosity),
|
2021-05-11 17:10:51 +00:00
|
|
|
|
|
|
|
|
// Windscribe specific
|
2021-09-14 15:23:56 +00:00
|
|
|
"ping 10",
|
2021-09-14 15:46:40 +00:00
|
|
|
"remote-cert-tls server",
|
|
|
|
|
"verify-x509-name " + connection.Hostname + " name",
|
2021-05-11 17:10:51 +00:00
|
|
|
"key-direction 1",
|
|
|
|
|
"reneg-sec 0",
|
2021-09-14 15:46:40 +00:00
|
|
|
"auth-user-pass " + constants.OpenVPNAuthConf,
|
2022-01-06 06:40:23 -05:00
|
|
|
"auth " + auth,
|
2021-05-11 17:10:51 +00:00
|
|
|
|
|
|
|
|
// Added constant values
|
|
|
|
|
"auth-nocache",
|
|
|
|
|
"mute-replay-warnings",
|
|
|
|
|
"pull-filter ignore \"auth-token\"", // prevent auth failed loops
|
|
|
|
|
"auth-retry nointeract",
|
|
|
|
|
"suppress-timestamps",
|
|
|
|
|
|
2021-09-14 15:46:40 +00:00
|
|
|
// Connection variables
|
2021-08-19 14:09:41 +00:00
|
|
|
connection.OpenVPNProtoLine(),
|
|
|
|
|
connection.OpenVPNRemoteLine(),
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
2021-10-05 20:36:23 +00:00
|
|
|
lines = append(lines, utils.CipherLines(settings.Ciphers, settings.Version)...)
|
2021-05-11 17:10:51 +00:00
|
|
|
|
2021-09-14 15:13:40 +00:00
|
|
|
if connection.Protocol == constants.UDP {
|
|
|
|
|
lines = append(lines, "explicit-exit-notify")
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-27 23:34:19 +00:00
|
|
|
if settings.ProcessUser != "root" {
|
|
|
|
|
lines = append(lines, "user "+settings.ProcessUser)
|
2021-09-14 14:54:59 +00:00
|
|
|
lines = append(lines, "persist-tun")
|
2021-09-14 14:55:39 +00:00
|
|
|
lines = append(lines, "persist-key")
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
if *settings.MSSFix > 0 {
|
|
|
|
|
lines = append(lines, "mssfix "+strconv.Itoa(int(*settings.MSSFix)))
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
if !*settings.IPv6 {
|
2021-07-19 01:46:20 +00:00
|
|
|
lines = append(lines, `pull-filter ignore "route-ipv6"`)
|
|
|
|
|
lines = append(lines, `pull-filter ignore "ifconfig-ipv6"`)
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 17:10:51 +00:00
|
|
|
lines = append(lines, utils.WrapOpenvpnCA(
|
2022-02-13 01:21:25 +00:00
|
|
|
constants.WindscribeCA)...)
|
2021-05-11 17:10:51 +00:00
|
|
|
lines = append(lines, utils.WrapOpenvpnTLSAuth(
|
2022-02-13 01:21:25 +00:00
|
|
|
constants.WindscribeTLSAuth)...)
|
2021-05-11 17:10:51 +00:00
|
|
|
|
|
|
|
|
lines = append(lines, "")
|
|
|
|
|
|
2021-09-13 11:30:14 -04:00
|
|
|
return lines, nil
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|