2021-05-11 17:10:51 +00:00
|
|
|
package fastestvpn
|
|
|
|
|
|
|
|
|
|
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 (f *Fastestvpn) 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.AES256cbc}
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
2022-01-06 06:40:23 -05:00
|
|
|
auth := *settings.Auth
|
|
|
|
|
if auth == "" {
|
|
|
|
|
auth = constants.SHA256
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
2022-01-06 06:40:23 -05:00
|
|
|
|
|
|
|
|
mssFix := *settings.MSSFix
|
|
|
|
|
if mssFix == 0 {
|
|
|
|
|
mssFix = 1450
|
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
|
|
|
|
|
|
|
|
// Fastestvpn specific
|
2022-01-06 06:40:23 -05:00
|
|
|
"mssfix " + strconv.Itoa(int(mssFix)), // defaults to 1450
|
2021-09-14 15:46:40 +00:00
|
|
|
"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
|
|
|
|
|
"key-direction 1",
|
|
|
|
|
"auth-user-pass " + constants.OpenVPNAuthConf,
|
2022-01-06 06:40:23 -05:00
|
|
|
"auth " + auth,
|
2021-09-28 13:52:07 +00:00
|
|
|
"comp-lzo",
|
|
|
|
|
"reneg-sec 0",
|
2021-05-11 17:10:51 +00:00
|
|
|
|
|
|
|
|
// Added constant values
|
|
|
|
|
"auth-nocache",
|
|
|
|
|
"mute-replay-warnings",
|
2021-09-28 13:52:07 +00:00
|
|
|
// "pull-filter ignore \"auth-token\"", // needed for FastestVPN
|
2021-05-11 17:10:51 +00:00
|
|
|
"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-23 17:40:14 +00:00
|
|
|
|
2021-09-14 15:13:40 +00:00
|
|
|
if connection.Protocol == constants.UDP {
|
|
|
|
|
lines = append(lines, "explicit-exit-notify")
|
2021-09-28 13:52:07 +00:00
|
|
|
lines = append(lines, "tun-mtu 1500") // FastestVPN specific
|
|
|
|
|
lines = append(lines, "tun-mtu-extra 32") // FastestVPN specific
|
|
|
|
|
lines = append(lines, "ping 15") // FastestVPN specific
|
2021-09-14 15:13:40 +00:00
|
|
|
}
|
|
|
|
|
|
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.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.FastestvpnCA)...)
|
2021-05-11 17:10:51 +00:00
|
|
|
lines = append(lines, utils.WrapOpenvpnTLSAuth(
|
2022-02-13 01:21:25 +00:00
|
|
|
constants.FastestvpnTLSAuth)...)
|
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
|
|
|
}
|