Files
vpngate/pkg/vpn/list_test.go
Dave Gallant 16aa16c66e Add support for HTTP and SOCKS5 proxies (#127)
As mentioned in https://github.com/davegallant/vpngate/issues/126, adding support for proxies will help bypass issues when vpngate.net is not accessible directly.

This works by:

```sh
# http proxy
sudo vpngate connect --proxy "http://localhost:8080"

# socks5 proxy
sudo vpngate connect --socks5 "127.0.0.1:1080"
```
2024-07-21 14:38:26 -04:00

33 lines
759 B
Go

package vpn
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
// TestGetListReal tests getting the real list of vpn servers
func TestGetListReal(t *testing.T) {
_, err := GetList("", "")
assert.NoError(t, err)
}
// TestParseVpnList parses a local copy of vpn list csv
func TestParseVpnList(t *testing.T) {
dat, err := os.Open("../../test_data/vpn_list.csv")
assert.NoError(t, err)
servers, err := parseVpnList(dat)
assert.NoError(t, err)
assert.Equal(t, len(*servers), 98)
assert.Equal(t, (*servers)[0].CountryLong, "Japan")
assert.Equal(t, (*servers)[0].CountryShort, "jp")
assert.Equal(t, (*servers)[0].HostName, "public-vpn-227")
assert.Equal(t, (*servers)[0].Ping, "13")
assert.Equal(t, (*servers)[0].Score, 2086924)
}