Feat: Wireguard support for Ivpn (#584)

This commit is contained in:
Quentin McGaw (desktop)
2021-08-23 16:01:01 +00:00
parent eb6238ee52
commit 06a2d79cb4
14 changed files with 403 additions and 60 deletions

View File

@@ -130,6 +130,21 @@ func Test_getPort(t *testing.T) {
},
port: 1234,
},
"Wireguard": {
selection: configuration.ServerSelection{
VPN: constants.Wireguard,
},
port: 58237,
},
"Wireguard custom port": {
selection: configuration.ServerSelection{
VPN: constants.Wireguard,
Wireguard: configuration.WireguardSelection{
CustomPort: 1234,
},
},
port: 1234,
},
}
for name, testCase := range testCases {
@@ -148,16 +163,27 @@ func Test_getProtocol(t *testing.T) {
t.Parallel()
testCases := map[string]struct {
tcp bool
protocol string
selection configuration.ServerSelection
protocol string
}{
"UDP": {
"OpenVPN UDP": {
protocol: constants.UDP,
},
"TCP": {
tcp: true,
"OpenVPN TCP": {
selection: configuration.ServerSelection{
VPN: constants.OpenVPN,
OpenVPN: configuration.OpenVPNSelection{
TCP: true,
},
},
protocol: constants.TCP,
},
"Wireguard": {
selection: configuration.ServerSelection{
VPN: constants.Wireguard,
},
protocol: constants.UDP,
},
}
for name, testCase := range testCases {
@@ -165,7 +191,7 @@ func Test_getProtocol(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()
protocol := getProtocol(testCase.tcp)
protocol := getProtocol(testCase.selection)
assert.Equal(t, testCase.protocol, protocol)
})