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:
@@ -18,7 +18,7 @@ func markdownTableHeading(legendFields ...string) (markdown string) {
|
||||
}
|
||||
|
||||
func (s *CyberghostServers) ToMarkdown() (markdown string) {
|
||||
markdown = markdownTableHeading("Country", "Group", "Hostname")
|
||||
markdown = markdownTableHeading("Country", "Hostname", "TCP", "UDP")
|
||||
for _, server := range s.Servers {
|
||||
markdown += server.ToMarkdown() + "\n"
|
||||
}
|
||||
@@ -26,7 +26,8 @@ func (s *CyberghostServers) ToMarkdown() (markdown string) {
|
||||
}
|
||||
|
||||
func (s CyberghostServer) ToMarkdown() (markdown string) {
|
||||
return fmt.Sprintf("| %s | %s | `%s` |", s.Country, s.Group, s.Hostname)
|
||||
return fmt.Sprintf("| %s | `%s` | %s | %s |", s.Country, s.Hostname,
|
||||
boolToMarkdown(s.TCP), boolToMarkdown(s.UDP))
|
||||
}
|
||||
|
||||
func (s *FastestvpnServers) ToMarkdown() (markdown string) {
|
||||
|
||||
@@ -11,16 +11,16 @@ func Test_CyberghostServers_ToMarkdown(t *testing.T) {
|
||||
|
||||
servers := CyberghostServers{
|
||||
Servers: []CyberghostServer{
|
||||
{Country: "a", Group: "A", Hostname: "xa"},
|
||||
{Country: "b", Group: "A", Hostname: "xb"},
|
||||
{Country: "a", UDP: true, Hostname: "xa"},
|
||||
{Country: "b", TCP: true, Hostname: "xb"},
|
||||
},
|
||||
}
|
||||
|
||||
markdown := servers.ToMarkdown()
|
||||
const expected = "| Country | Group | Hostname |\n" +
|
||||
"| --- | --- | --- |\n" +
|
||||
"| a | A | `xa` |\n" +
|
||||
"| b | A | `xb` |\n"
|
||||
const expected = "| Country | Hostname | TCP | UDP |\n" +
|
||||
"| --- | --- | --- | --- |\n" +
|
||||
"| a | `xa` | ❎ | ✅ |\n" +
|
||||
"| b | `xb` | ✅ | ❎ |\n"
|
||||
|
||||
assert.Equal(t, expected, markdown)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import (
|
||||
|
||||
type CyberghostServer struct {
|
||||
Country string `json:"country"`
|
||||
Group string `json:"group"`
|
||||
Hostname string `json:"hostname"`
|
||||
TCP bool `json:"tcp"`
|
||||
UDP bool `json:"udp"`
|
||||
IPs []net.IP `json:"ips"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user