Maint: Remove CYBERGHOST_GROUP (change)

- It does not make any sense with newer server data
- It was to be deprecated anyway
This commit is contained in:
Quentin McGaw (desktop)
2021-09-23 13:54:24 +00:00
parent 625de1c834
commit f9aadeef1c
17 changed files with 1910 additions and 1846 deletions

View File

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

View File

@@ -1,30 +0,0 @@
package constants
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/storage"
"github.com/qdm12/golibs/logging/mock_logging"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_CyberghostGroupChoices(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
logger := mock_logging.NewMockLogger(ctrl)
logger.EXPECT().Info(gomock.Any())
storage, err := storage.New(logger, "")
require.NoError(t, err)
servers := storage.GetServers()
expected := []string{"NoSpy TCP Europe", "NoSpy UDP Europe",
"Premium TCP Europe", "Premium UDP Europe"}
choices := CyberghostGroupChoices(servers.GetCyberghost())
assert.Equal(t, expected, choices)
}