summaryrefslogtreecommitdiff
path: root/pkg/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/vpn')
-rw-r--r--pkg/vpn/launcher.go7
-rw-r--r--pkg/vpn/openvpn.go7
2 files changed, 11 insertions, 3 deletions
diff --git a/pkg/vpn/launcher.go b/pkg/vpn/launcher.go
index 1b2d673..f6e08eb 100644
--- a/pkg/vpn/launcher.go
+++ b/pkg/vpn/launcher.go
@@ -24,6 +24,7 @@ import (
"io/ioutil"
"log"
"net/http"
+ "os"
"strconv"
"strings"
"time"
@@ -115,7 +116,11 @@ func (l *launcher) firewallStart(gateways []bonafide.Gateway) error {
if err != nil {
return err
}
- return l.send("/firewall/start", byteIPs)
+ uri := "/firewall/start"
+ if os.Getenv("UDP") == "1" {
+ uri = uri + "?udp=1"
+ }
+ return l.send(uri, byteIPs)
}
func (l *launcher) firewallStop() error {
diff --git a/pkg/vpn/openvpn.go b/pkg/vpn/openvpn.go
index d4e6330..e110d45 100644
--- a/pkg/vpn/openvpn.go
+++ b/pkg/vpn/openvpn.go
@@ -155,6 +155,11 @@ func (b *Bitmask) startOpenVPN() error {
if err != nil {
return err
}
+ if b.udp {
+ os.Setenv("UDP", "1")
+ } else {
+ os.Setenv("UDP", "0")
+ }
err = b.launch.firewallStart(gateways)
if err != nil {
return err
@@ -164,10 +169,8 @@ func (b *Bitmask) startOpenVPN() error {
for _, port := range gw.Ports {
if port != "53" {
if b.udp {
- os.Setenv("UDP", "1")
arg = append(arg, "--remote", gw.IPAddress, port, "udp4")
} else {
- os.Setenv("UDP", "0")
arg = append(arg, "--remote", gw.IPAddress, port, "tcp4")
}
}