summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-12-20 15:34:50 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-12-21 18:28:00 +0100
commit697dfed1f9f5d2916889a81a7a64bd1158caf2d2 (patch)
treee6354e890178f88f289b044b41da2aab03e64573
parenta97c3c40c33b4b11591c33aa0c2fd8f6d5b23e9d (diff)
Server: Implement forcing WireGuard selection through env
-rw-r--r--internal/server/server.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 1637d35..9354883 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -244,6 +244,14 @@ func Config(server Server, wireguardSupport bool, preferTCP bool) (string, strin
ovpn := p.supportsOpenVPN()
wg := p.supportsWireguard() && wireguardSupport
+ // If we don't prefer TCP and this profile and client supports wireguard,
+ // we disable openvpn if the EDUVPN_PREFER_WG environment variable is set
+ // This is useful to force WireGuard if the profile supports both OpenVPN and WireGuard but the server still prefers OpenVPN
+ if !preferTCP && wg {
+ if os.Getenv("EDUVPN_PREFER_WG") == "1" {
+ ovpn = false
+ }
+ }
switch {
// The config supports wireguard and optionally openvpn