Maint: migrate Cyberghost REGION to COUNTRY

This commit is contained in:
Quentin McGaw (desktop)
2021-09-23 13:28:32 +00:00
parent 1c0a3ed1a4
commit 625de1c834
13 changed files with 1349 additions and 1663 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/golibs/params"
)
func (settings *Provider) readCyberghost(r reader) (err error) {
@@ -21,9 +22,11 @@ func (settings *Provider) readCyberghost(r reader) (err error) {
return fmt.Errorf("environment variable CYBERGHOST_GROUP: %w", err)
}
settings.ServerSelection.Regions, err = r.env.CSVInside("REGION", constants.CyberghostRegionChoices(servers))
settings.ServerSelection.Countries, err = r.env.CSVInside("COUNTRY",
constants.CyberghostCountryChoices(servers),
params.RetroKeys([]string{"REGION"}, r.onRetroActive))
if err != nil {
return fmt.Errorf("environment variable REGION: %w", err)
return fmt.Errorf("environment variable COUNTRY: %w", err)
}
settings.ServerSelection.Hostnames, err = r.env.CSVInside("SERVER_HOSTNAME",

View File

@@ -24,15 +24,15 @@ func Test_Provider_lines(t *testing.T) {
settings: Provider{
Name: constants.Cyberghost,
ServerSelection: ServerSelection{
VPN: constants.OpenVPN,
Groups: []string{"group"},
Regions: []string{"a", "El country"},
VPN: constants.OpenVPN,
Groups: []string{"group"},
Countries: []string{"a", "El country"},
},
},
lines: []string{
"|--Cyberghost settings:",
" |--Server groups: group",
" |--Regions: a, El country",
" |--Countries: a, El country",
" |--OpenVPN selection:",
" |--Protocol: udp",
},