chore(constants): internal/constants/providers

- New package to avoid package import cycles
This commit is contained in:
Quentin McGaw
2022-04-16 19:30:26 +00:00
parent ad80e0c1ab
commit 54b7e23974
51 changed files with 335 additions and 339 deletions

View File

@@ -6,7 +6,7 @@ import (
"regexp"
"github.com/qdm12/gluetun/internal/configuration/settings/helpers"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gotree"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
@@ -35,10 +35,10 @@ var regexpInterfaceName = regexp.MustCompile(`^[a-zA-Z0-9_]+$`)
// It should only be ran if the VPN type chosen is Wireguard.
func (w Wireguard) validate(vpnProvider string) (err error) {
if !helpers.IsOneOf(vpnProvider,
constants.Custom,
constants.Ivpn,
constants.Mullvad,
constants.Windscribe,
providers.Custom,
providers.Ivpn,
providers.Mullvad,
providers.Windscribe,
) {
// do not validate for VPN provider not supporting Wireguard
return nil