From ae074dfb2b6d898ccf52fd4dbcda2c9235432353 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Thu, 6 Jan 2022 19:16:14 +0000 Subject: [PATCH] hotfix(surfshark): `REGION` retro-compatibility --- internal/configuration/settings/provider.go | 3 ++- internal/configuration/settings/settings.go | 5 ++++- internal/configuration/settings/vpn.go | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/configuration/settings/provider.go b/internal/configuration/settings/provider.go index 3006b6bc..ff1bf4b6 100644 --- a/internal/configuration/settings/provider.go +++ b/internal/configuration/settings/provider.go @@ -21,7 +21,8 @@ type Provider struct { PortForwarding PortForwarding } -func (p Provider) validate(vpnType string, allServers models.AllServers) (err error) { +// TODO v4 remove pointer for receiver (because of Surfshark). +func (p *Provider) validate(vpnType string, allServers models.AllServers) (err error) { // Validate Name var validNames []string if vpnType == constants.OpenVPN { diff --git a/internal/configuration/settings/settings.go b/internal/configuration/settings/settings.go index ab7d8152..48de474f 100644 --- a/internal/configuration/settings/settings.go +++ b/internal/configuration/settings/settings.go @@ -22,7 +22,10 @@ type Settings struct { VPN VPN } -func (s Settings) Validate(allServers models.AllServers) (err error) { +// Validate validates all the settings and returns an error +// if one of them is not valid. +// TODO v4 remove pointer for receiver (because of Surfshark). +func (s *Settings) Validate(allServers models.AllServers) (err error) { nameToValidation := map[string]func() error{ "control server": s.ControlServer.validate, "dns": s.DNS.validate, diff --git a/internal/configuration/settings/vpn.go b/internal/configuration/settings/vpn.go index 71bd62bc..df4c7a12 100644 --- a/internal/configuration/settings/vpn.go +++ b/internal/configuration/settings/vpn.go @@ -20,8 +20,8 @@ type VPN struct { Wireguard Wireguard } -// Validate validates VPN settings. -func (v VPN) validate(allServers models.AllServers) (err error) { +// TODO v4 remove pointer for receiver (because of Surfshark). +func (v *VPN) validate(allServers models.AllServers) (err error) { // Validate Type validVPNTypes := []string{constants.OpenVPN, constants.Wireguard} if !helpers.IsOneOf(v.Type, validVPNTypes...) {