Mullvad updater (#228)

* Add Mullvad to updater cli
* Update hardcoded servers for Mullvad
This commit is contained in:
Quentin McGaw
2020-08-29 13:19:34 -04:00
committed by GitHub
parent d463e4cb69
commit 049bc5b226
11 changed files with 422 additions and 534 deletions

View File

@@ -0,0 +1,31 @@
package updater
import (
"net"
"strings"
"testing"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
)
func Test_stringifyMullvadServers(t *testing.T) {
servers := []models.MullvadServer{{
Country: "webland",
City: "webcity",
ISP: "not nsa",
Owned: true,
IPs: []net.IP{{1, 1, 1, 1}},
IPsV6: []net.IP{{1, 1, 1, 1}},
}}
expected := `
func MullvadServers() []models.MullvadServer {
return []models.MullvadServer{
{Country: "webland", City: "webcity", ISP: "not nsa", Owned: true, IPs: []net.IP{{1, 1, 1, 1}}, IPsV6: []net.IP{{1, 1, 1, 1}}},
}
}
`
expected = strings.TrimPrefix(strings.TrimSuffix(expected, "\n"), "\n")
s := stringifyMullvadServers(servers)
assert.Equal(t, expected, s)
}