From 3934d75ac516a530ceb9f494f7ce0de12cb1b5de Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 28 Nov 2022 15:04:47 +0100 Subject: Lint: Use gocritic linter and fix errors returned by it --- internal/server/common.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'internal/server') 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")) } -- cgit v1.2.3