From 6981666c6d8f639a1ff9c09a3bc08769e19928af Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 20 Dec 2022 15:35:44 +0100 Subject: Failover: Initial implementation --- internal/server/server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'internal/server/server.go') diff --git a/internal/server/server.go b/internal/server/server.go index 9354883..78f6472 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -1,6 +1,7 @@ package server import ( + "os" "time" "github.com/eduvpn/eduvpn-common/internal/oauth" @@ -219,7 +220,7 @@ func HasValidProfile(srv Server, wireguardSupport bool) (bool, error) { return false, err } // Profile does not support OpenVPN but the client also doesn't support WireGuard - if !p.supportsOpenVPN() && !wireguardSupport { + if !p.SupportsOpenVPN() && !wireguardSupport { return false, nil } return true, nil @@ -242,8 +243,9 @@ func Config(server Server, wireguardSupport bool, preferTCP bool) (string, strin return "", "", err } - ovpn := p.supportsOpenVPN() - wg := p.supportsWireguard() && wireguardSupport + 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 -- cgit v1.2.3