summaryrefslogtreecommitdiff
path: root/internal/server
diff options
context:
space:
mode:
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/common.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/server/common.go b/internal/server/common.go
index 3db535c..f0274ed 100644
--- a/internal/server/common.go
+++ b/internal/server/common.go
@@ -508,16 +508,17 @@ func Config(server Server, clientSupportsWireguard bool, preferTCP bool) (string
var configType string
var configErr error
- // The config supports wireguard, do a specialized request with a public key
- if supportsWireguard {
+ switch {
+ // The config supports wireguard and optionally openvpn
+ case supportsWireguard:
// A wireguard connect call needs to generate a wireguard key and add it to the config
// Also the server could send back an OpenVPN config if it supports OpenVPN
config, configType, configErr = wireguardGetConfig(server, preferTCP, supportsOpenVPN)
- // The config only supports OpenVPN
- } else if supportsOpenVPN {
+ // The config only supports OpenVPN
+ case supportsOpenVPN:
config, configType, configErr = openVPNGetConfig(server, preferTCP)
// The config supports no available protocol because the profile only supports WireGuard but the client doesn't
- } else {
+ default:
return "", "", types.NewWrappedError(errorMessage, errors.New("no supported protocol found"))
}