summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-04-21 19:57:09 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-04-30 22:10:23 +0200
commitb093455df6fb4dc2d9c1339a3ccff0aa6396088b (patch)
treec0b9056fc3b5b5b89f4350bfefaa9f5b36ec490e
parentd46ac15fbe1b7509ca7a28ef4a8062a1bacef070 (diff)
[feat] write port in darwin too
-rw-r--r--pkg/helper/darwin.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/helper/darwin.go b/pkg/helper/darwin.go
index 7f68243..3f8dc2f 100644
--- a/pkg/helper/darwin.go
+++ b/pkg/helper/darwin.go
@@ -87,8 +87,11 @@ func daemonize() {
log.Print("bitmask-helper daemon started")
}
-func doHandleCommands(port int) {
- runCommandServer("localhost:" + strconv.Itoa(port))
+func doHandleCommands(preferredPort int) {
+ port := getFirstAvailablePortFrom(preferredPort)
+ writePortToFile(port)
+ bindAddr := "localhost:" + strconv.Itoa(port)
+ runCommandServer(bindAddr)
}
func getOpenvpnPath() string {