Feature: OPENVPN_MSSFIX variable

This commit is contained in:
Quentin McGaw
2021-01-19 02:55:38 +00:00
parent 4530dd4fea
commit e7372f22cb
13 changed files with 58 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"strings"
"github.com/qdm12/gluetun/internal/constants"
@@ -108,6 +109,9 @@ func (c *cyberghost) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -117,6 +118,9 @@ func (m *mullvad) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -87,6 +88,11 @@ func (n *nordvpn) BuildConf(connection models.OpenVPNConnection,
if len(settings.Auth) == 0 {
settings.Auth = "sha512"
}
const defaultMSSFix = 1450
if settings.MSSFix == 0 {
settings.MSSFix = defaultMSSFix
}
lines = []string{
"client",
"dev tun",
@@ -97,7 +103,7 @@ func (n *nordvpn) BuildConf(connection models.OpenVPNConnection,
// Nordvpn specific
"tun-mtu 1500",
"tun-mtu-extra 32",
"mssfix 1450",
"mssfix " + strconv.Itoa(int(settings.MSSFix)),
"ping 15",
"ping-restart 0",
"ping-timer-rem",

View File

@@ -12,6 +12,7 @@ import (
"net"
"net/http"
"net/url"
"strconv"
"strings"
"time"
@@ -164,6 +165,9 @@ func (p *pia) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<crl-verify>",
"-----BEGIN X509 CRL-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -107,6 +108,9 @@ func (s *privado) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -111,6 +112,9 @@ func (p *purevpn) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -82,6 +83,12 @@ func (s *surfshark) BuildConf(connection models.OpenVPNConnection,
if len(settings.Auth) == 0 {
settings.Auth = "SHA512"
}
const defaultMSSFix = 1450
if settings.MSSFix == 0 {
settings.MSSFix = defaultMSSFix
}
lines = []string{
"client",
"dev tun",
@@ -92,7 +99,7 @@ func (s *surfshark) BuildConf(connection models.OpenVPNConnection,
// Surfshark specific
"tun-mtu 1500",
"tun-mtu-extra 32",
"mssfix 1450",
"mssfix " + strconv.Itoa(int(settings.MSSFix)),
"ping 15",
"ping-restart 60",
"ping-timer-rem",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
@@ -109,6 +110,9 @@ func (v *vyprvpn) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",

View File

@@ -6,6 +6,7 @@ import (
"math/rand"
"net"
"net/http"
"strconv"
"strings"
"github.com/qdm12/gluetun/internal/constants"
@@ -114,6 +115,9 @@ func (w *windscribe) BuildConf(connection models.OpenVPNConnection,
if !settings.Root {
lines = append(lines, "user "+username)
}
if settings.MSSFix > 0 {
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
}
lines = append(lines, []string{
"<ca>",
"-----BEGIN CERTIFICATE-----",