hotfix(nordvpn): accept countries in SERVER_REGIONS

This commit is contained in:
Quentin McGaw
2023-06-10 16:28:39 +00:00
parent ea1991496e
commit 4a0f9c36ba
2 changed files with 50 additions and 1 deletions

View File

@@ -88,6 +88,14 @@ func (ss *ServerSelection) validate(vpnServiceProvider string,
return err // already wrapped error
}
// Retro-compatibility
switch vpnServiceProvider {
case providers.Nordvpn:
*ss = nordvpnRetroRegion(*ss, filterChoices.Regions, filterChoices.Countries)
case providers.Surfshark:
*ss = surfsharkRetroRegion(*ss)
}
err = validateServerFilters(*ss, filterChoices)
if err != nil {
return fmt.Errorf("for VPN service provider %s: %w", vpnServiceProvider, err)
@@ -163,7 +171,6 @@ func getLocationFilterChoices(vpnServiceProvider string,
if err != nil {
return models.FilterChoices{}, fmt.Errorf("%w: %w", ErrRegionNotValid, err)
}
*ss = surfsharkRetroRegion(*ss)
}
return filterChoices, nil