diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-08-11 22:38:13 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-08-11 22:38:13 +0200 |
commit | 5ba62c56b2a94b9f5ae06b150713f84d5a3144fa (patch) | |
tree | 5f572c3a06dbd91a144efb63a4dba55535fdd65a /pkg/backend/api.go | |
parent | 33b9ba9abadb8cea8f5840bb11fb9de489b120e3 (diff) |
[refactor] simplify, make port optional
Diffstat (limited to 'pkg/backend/api.go')
-rw-r--r-- | pkg/backend/api.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go index f63962c..0cab17f 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -6,6 +6,7 @@ import ( "C" "fmt" "log" + "strconv" "unsafe" "0xacab.org/leap/bitmask-vpn/pkg/bitmask" @@ -76,8 +77,12 @@ func EnableMockBackend() { go enableMockBackend() } -func EnableWebAPI() { - go enableWebAPI() +func EnableWebAPI(port string) { + intPort, err := strconv.Atoi(port) + if err != nil { + log.Fatal("Cannot parse port", port) + } + go enableWebAPI(intPort) } /* these two are a bit redundant since we already add them to ctx. however, we |