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:
Quentin McGaw (desktop)
2021-07-31 14:53:34 +00:00
parent c17b351efb
commit 982536e9e8
9 changed files with 199 additions and 48 deletions

View File

@@ -1,6 +1,8 @@
package constants
import (
"sort"
"github.com/qdm12/gluetun/internal/models"
)
@@ -20,11 +22,20 @@ func CyberghostRegionChoices() (choices []string) {
func CyberghostGroupChoices() (choices []string) {
servers := CyberghostServers()
choices = make([]string, len(servers))
for i := range servers {
choices[i] = servers[i].Group
uniqueChoices := map[string]struct{}{}
for _, server := range servers {
uniqueChoices[server.Group] = struct{}{}
}
return makeUnique(choices)
choices = make([]string, 0, len(uniqueChoices))
for choice := range uniqueChoices {
choices = append(choices, choice)
}
sortable := sort.StringSlice(choices)
sortable.Sort()
return sortable
}
func CyberghostHostnameChoices() (choices []string) {