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,15 +1,17 @@
package cyberghost
func getGroups() map[string]string {
import "github.com/qdm12/gluetun/internal/constants"
func getGroupIDToProtocol() map[string]string {
return map[string]string{
"87-1": "Premium UDP Europe",
"94-1": "Premium UDP USA",
"95-1": "Premium UDP Asia",
"87-8": "NoSpy UDP Europe",
"97-1": "Premium TCP Europe",
"93-1": "Premium TCP USA",
"96-1": "Premium TCP Asia",
"97-8": "NoSpy TCP Europe",
"87-1": constants.UDP, // Premium UDP Europe
"94-1": constants.UDP, // Premium UDP USA
"95-1": constants.UDP, // Premium UDP Asia
"87-8": constants.UDP, // NoSpy UDP Europe
"97-1": constants.TCP, // Premium TCP Europe
"93-1": constants.TCP, // Premium TCP USA
"96-1": constants.TCP, // Premium TCP Asia
"97-8": constants.TCP, // NoSpy TCP Europe
}
}

View File

@@ -10,24 +10,25 @@ import (
type hostToServer map[string]models.CyberghostServer
func getPossibleServers() (possibleServers hostToServer) {
groups := getGroups()
groupIDToProtocol := getGroupIDToProtocol()
cyberghostCountryCodes := getSubdomainToRegion()
allCountryCodes := constants.CountryCodes()
possibleCountryCodes := mergeCountryCodes(cyberghostCountryCodes, allCountryCodes)
n := len(groups) * len(possibleCountryCodes)
n := len(groupIDToProtocol) * len(possibleCountryCodes)
possibleServers = make(hostToServer, n) // key is the host
for groupID, groupName := range groups {
for groupID, protocol := range groupIDToProtocol {
for countryCode, country := range possibleCountryCodes {
const domain = "cg-dialup.net"
possibleHost := groupID + "-" + countryCode + "." + domain
possibleServer := models.CyberghostServer{
Hostname: possibleHost,
Country: country,
Group: groupName,
TCP: protocol == constants.TCP,
UDP: protocol == constants.UDP,
}
possibleServers[possibleHost] = possibleServer
}

View File

@@ -9,10 +9,7 @@ import (
func sortServers(servers []models.CyberghostServer) {
sort.Slice(servers, func(i, j int) bool {
if servers[i].Country == servers[j].Country {
if servers[i].Group == servers[j].Group {
return servers[i].Hostname < servers[j].Hostname
}
return servers[i].Group < servers[j].Group
return servers[i].Hostname < servers[j].Hostname
}
return servers[i].Country < servers[j].Country
})