Fix & feat: Cyberghost server groups
- Allow multiple comma separated values for CYBERGHOST_GROUP - Defaults to all UDP groups - If TCP is enabled, defaults to all TCP groups - Check groups specified match the protocol - Default Cyberghost group to empty - Adjust formatting and messages
This commit is contained in:
@@ -4,11 +4,10 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/golibs/params"
|
||||
)
|
||||
|
||||
func (settings *Provider) cyberghostLines() (lines []string) {
|
||||
lines = append(lines, lastIndent+"Server group: "+settings.ServerSelection.Group)
|
||||
lines = append(lines, lastIndent+"Server groups: "+commaJoin(settings.ServerSelection.Groups))
|
||||
|
||||
if len(settings.ServerSelection.Regions) > 0 {
|
||||
lines = append(lines, lastIndent+"Regions: "+commaJoin(settings.ServerSelection.Regions))
|
||||
@@ -52,8 +51,8 @@ func (settings *Provider) readCyberghost(r reader) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
settings.ServerSelection.Group, err = r.env.Inside("CYBERGHOST_GROUP",
|
||||
constants.CyberghostGroupChoices(), params.Default("Premium UDP Europe"))
|
||||
settings.ServerSelection.Groups, err = r.env.CSVInside("CYBERGHOST_GROUP",
|
||||
constants.CyberghostGroupChoices())
|
||||
if err != nil {
|
||||
return fmt.Errorf("environment variable CYBERGHOST_GROUP: %w", err)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func Test_OpenVPN_JSON(t *testing.T) {
|
||||
"server_selection": {
|
||||
"tcp": false,
|
||||
"regions": null,
|
||||
"group": "",
|
||||
"groups": null,
|
||||
"countries": null,
|
||||
"cities": null,
|
||||
"hostnames": null,
|
||||
|
||||
@@ -24,7 +24,7 @@ func Test_Provider_lines(t *testing.T) {
|
||||
settings: Provider{
|
||||
Name: constants.Cyberghost,
|
||||
ServerSelection: ServerSelection{
|
||||
Group: "group",
|
||||
Groups: []string{"group"},
|
||||
Regions: []string{"a", "El country"},
|
||||
},
|
||||
ExtraConfigOptions: ExtraConfigOptions{
|
||||
@@ -35,7 +35,7 @@ func Test_Provider_lines(t *testing.T) {
|
||||
lines: []string{
|
||||
"|--Cyberghost settings:",
|
||||
" |--Network protocol: udp",
|
||||
" |--Server group: group",
|
||||
" |--Server groups: group",
|
||||
" |--Regions: a, El country",
|
||||
" |--Client key is set",
|
||||
" |--Client certificate is set",
|
||||
|
||||
@@ -13,7 +13,7 @@ type ServerSelection struct { //nolint:maligned
|
||||
Regions []string `json:"regions"`
|
||||
|
||||
// Cyberghost
|
||||
Group string `json:"group"`
|
||||
Groups []string `json:"groups"`
|
||||
|
||||
// Fastestvpn, HideMyAss, IPVanish, IVPN, Mullvad, PrivateVPN, Protonvpn, PureVPN, VPNUnlimited
|
||||
Countries []string `json:"countries"`
|
||||
|
||||
Reference in New Issue
Block a user