diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 15:04:47 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 15:04:47 +0100 |
| commit | 3934d75ac516a530ceb9f494f7ce0de12cb1b5de (patch) | |
| tree | 23c905ad43340e3192362afaeec8b6f6731575a8 /internal/server | |
| parent | f884b3df2762a1bd3799441e06659b9caad4ee6c (diff) | |
Lint: Use gocritic linter and fix errors returned by it
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/common.go | 11 |
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")) } |
