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 | |
| parent | f884b3df2762a1bd3799441e06659b9caad4ee6c (diff) | |
Lint: Use gocritic linter and fix errors returned by it
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/server/common.go | 11 | ||||
| -rw-r--r-- | internal/util/util.go | 2 |
2 files changed, 7 insertions, 6 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")) } diff --git a/internal/util/util.go b/internal/util/util.go index 3ce1992..ddd165d 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -40,7 +40,7 @@ func EnsureValidURL(s string) (string, error) { // Make sure the URL ends with a / if returnedURL[len(returnedURL)-1:] != "/" { - returnedURL = returnedURL + "/" + returnedURL += "/" } return returnedURL, nil } |
