Allow empty string for CSV variables with golibs
This commit is contained in:
@@ -18,8 +18,7 @@ func (p *reader) GetCyberghostGroup() (group string, err error) {
|
||||
// GetCyberghostRegions obtains the country names for the Cyberghost servers from the
|
||||
// environment variable REGION.
|
||||
func (p *reader) GetCyberghostRegions() (regions []string, err error) {
|
||||
choices := append(constants.CyberghostRegionChoices(), "")
|
||||
return p.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return p.envParams.GetCSVInPossibilities("REGION", constants.CyberghostRegionChoices())
|
||||
}
|
||||
|
||||
// GetCyberghostClientKey obtains the one line client key to use for openvpn from the
|
||||
|
||||
@@ -8,22 +8,19 @@ import (
|
||||
// GetMullvadCountries obtains the countries for the Mullvad servers from the
|
||||
// environment variable COUNTRY.
|
||||
func (r *reader) GetMullvadCountries() (countries []string, err error) {
|
||||
choices := append(constants.MullvadCountryChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("COUNTRY", choices)
|
||||
return r.envParams.GetCSVInPossibilities("COUNTRY", constants.MullvadCountryChoices())
|
||||
}
|
||||
|
||||
// GetMullvadCity obtains the cities for the Mullvad servers from the
|
||||
// environment variable CITY.
|
||||
func (r *reader) GetMullvadCities() (cities []string, err error) {
|
||||
choices := append(constants.MullvadCityChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("CITY", choices)
|
||||
return r.envParams.GetCSVInPossibilities("CITY", constants.MullvadCityChoices())
|
||||
}
|
||||
|
||||
// GetMullvadISPs obtains the ISPs for the Mullvad servers from the
|
||||
// environment variable ISP.
|
||||
func (r *reader) GetMullvadISPs() (isps []string, err error) {
|
||||
choices := append(constants.MullvadISPChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("ISP", choices)
|
||||
return r.envParams.GetCSVInPossibilities("ISP", constants.MullvadISPChoices())
|
||||
}
|
||||
|
||||
// GetMullvadPort obtains the port to reach the Mullvad server on from the
|
||||
|
||||
@@ -10,8 +10,7 @@ import (
|
||||
// GetNordvpnRegions obtains the regions (countries) for the NordVPN server from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetNordvpnRegions() (regions []string, err error) {
|
||||
choices := append(constants.NordvpnRegionChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.NordvpnRegionChoices())
|
||||
}
|
||||
|
||||
// GetNordvpnRegion obtains the server numbers (optional) for the NordVPN servers from the
|
||||
|
||||
@@ -149,7 +149,7 @@ func (r *reader) GetVPNSP() (vpnServiceProvider models.VPNProvider, err error) {
|
||||
"pia", "private internet access", "private internet access old",
|
||||
"mullvad", "windscribe", "surfshark", "cyberghost",
|
||||
"vyprvpn", "nordvpn", "purevpn",
|
||||
})
|
||||
}, libparams.Default("private internet access"))
|
||||
if s == "pia" {
|
||||
s = "private internet access"
|
||||
}
|
||||
|
||||
@@ -42,8 +42,7 @@ func (r *reader) GetPIAEncryptionPreset() (preset string, err error) {
|
||||
// Retro-compatibility
|
||||
s, err := r.envParams.GetValueIfInside("ENCRYPTION", []string{
|
||||
constants.PIAEncryptionPresetNormal,
|
||||
constants.PIAEncryptionPresetStrong,
|
||||
""})
|
||||
constants.PIAEncryptionPresetStrong})
|
||||
if err != nil {
|
||||
return "", err
|
||||
} else if len(s) != 0 {
|
||||
@@ -62,13 +61,11 @@ func (r *reader) GetPIAEncryptionPreset() (preset string, err error) {
|
||||
// GetPIARegions obtains the regions for the PIA servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetPIARegions() (regions []string, err error) {
|
||||
choices := append(constants.PIAGeoChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.PIAGeoChoices())
|
||||
}
|
||||
|
||||
// GetPIAOldRegions obtains the regions for the PIA servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetPIAOldRegions() (regions []string, err error) {
|
||||
choices := append(constants.PIAOldGeoChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.PIAOldGeoChoices())
|
||||
}
|
||||
|
||||
@@ -7,20 +7,17 @@ import (
|
||||
// GetPurevpnRegions obtains the regions (continents) for the PureVPN servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetPurevpnRegions() (regions []string, err error) {
|
||||
choices := append(constants.PurevpnRegionChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.PurevpnRegionChoices())
|
||||
}
|
||||
|
||||
// GetPurevpnCountries obtains the countries for the PureVPN servers from the
|
||||
// environment variable COUNTRY.
|
||||
func (r *reader) GetPurevpnCountries() (countries []string, err error) {
|
||||
choices := append(constants.PurevpnCountryChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("COUNTRY", choices)
|
||||
return r.envParams.GetCSVInPossibilities("COUNTRY", constants.PurevpnCountryChoices())
|
||||
}
|
||||
|
||||
// GetPurevpnCities obtains the cities for the PureVPN servers from the
|
||||
// environment variable CITY.
|
||||
func (r *reader) GetPurevpnCities() (cities []string, err error) {
|
||||
choices := append(constants.PurevpnCityChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("CITY", choices)
|
||||
return r.envParams.GetCSVInPossibilities("CITY", constants.PurevpnCityChoices())
|
||||
}
|
||||
|
||||
@@ -7,6 +7,5 @@ import (
|
||||
// GetSurfsharkRegions obtains the regions for the Surfshark servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetSurfsharkRegions() (regions []string, err error) {
|
||||
choices := append(constants.SurfsharkRegionChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.SurfsharkRegionChoices())
|
||||
}
|
||||
|
||||
@@ -7,6 +7,5 @@ import (
|
||||
// GetVyprvpnRegions obtains the regions for the Vyprvpn servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetVyprvpnRegions() (regions []string, err error) {
|
||||
choices := append(constants.VyprvpnRegionChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.VyprvpnRegionChoices())
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ import (
|
||||
// GetWindscribeRegions obtains the regions for the Windscribe servers from the
|
||||
// environment variable REGION.
|
||||
func (r *reader) GetWindscribeRegions() (regions []string, err error) {
|
||||
choices := append(constants.WindscribeRegionChoices(), "")
|
||||
return r.envParams.GetCSVInPossibilities("REGION", choices)
|
||||
return r.envParams.GetCSVInPossibilities("REGION", constants.WindscribeRegionChoices())
|
||||
}
|
||||
|
||||
// GetMullvadPort obtains the port to reach the Mullvad server on from the
|
||||
|
||||
Reference in New Issue
Block a user