summaryrefslogtreecommitdiff
path: root/bitmask_go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-06-21 16:53:36 +0200
committerRuben Pollan <meskio@sindominio.net>2018-06-21 16:54:08 +0200
commit71f0b807670901dca8698deba1e21dd5b2a09567 (patch)
tree32c0421edc7edac47ee4ad1aef28e99145d54c73 /bitmask_go
parent14578be06da27c9f56675d6a162a160e4fcf233b (diff)
[bug] clean up vpn args for windows
Diffstat (limited to 'bitmask_go')
-rw-r--r--bitmask_go/bonafide.go4
-rw-r--r--bitmask_go/vpn.go25
2 files changed, 20 insertions, 9 deletions
diff --git a/bitmask_go/bonafide.go b/bitmask_go/bonafide.go
index 97d83c9..449383e 100644
--- a/bitmask_go/bonafide.go
+++ b/bitmask_go/bonafide.go
@@ -25,6 +25,7 @@ import (
"net/http"
"sort"
"strconv"
+ "strings"
"time"
)
@@ -150,7 +151,8 @@ func (b *bonafide) getOpenvpnArgs() ([]string, error) {
for arg, value := range b.eip.OpenvpnConfiguration {
switch v := value.(type) {
case string:
- args = append(args, "--"+arg, v)
+ args = append(args, "--"+arg)
+ args = append(args, strings.Split(v, " ")...)
case bool:
if v {
args = append(args, "--"+arg)
diff --git a/bitmask_go/vpn.go b/bitmask_go/vpn.go
index 2a0862b..44fa768 100644
--- a/bitmask_go/vpn.go
+++ b/bitmask_go/vpn.go
@@ -36,21 +36,30 @@ func (b *Bitmask) StartVPN(provider string) error {
return err
}
- arg := []string{"--nobind", "--verb", "1"}
- if runtime.GOOS == "windows" {
- arg = append(arg, "--dev", "tun", "--log", `C:\bitmask\openvp.log`)
- }
-
- bonafideArgs, err := b.bonafide.getOpenvpnArgs()
+ arg, err := b.bonafide.getOpenvpnArgs()
if err != nil {
return err
}
- arg = append(arg, bonafideArgs...)
for _, gw := range gateways {
arg = append(arg, "--remote", gw.IPAddress, "443", "tcp4")
}
certPemPath := b.getCertPemPath()
- arg = append(arg, "--client", "--tls-client", "--remote-cert-tls", "server", "--management-client", "--management", openvpnManagementAddr+" "+openvpnManagementPort, "--ca", b.getCaCertPath(), "--cert", certPemPath, "--key", certPemPath)
+ arg = append(arg,
+ "--nobind",
+ "--verb", "1",
+ "--dev", "tun",
+ "--client",
+ "--tls-client",
+ "--remote-cert-tls", "server",
+ "--script-security", "1",
+ "--management-client",
+ "--management", openvpnManagementAddr, openvpnManagementPort,
+ "--ca", b.getCaCertPath(),
+ "--cert", certPemPath,
+ "--key", certPemPath)
+ if runtime.GOOS == "windows" {
+ arg = append(arg, "--log", `C:\bitmask\openvp.log`)
+ }
return b.launch.openvpnStart(arg...)
}