summaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
Diffstat (limited to 'helper')
-rw-r--r--helper/darwin.go24
-rw-r--r--helper/helper.go24
2 files changed, 24 insertions, 24 deletions
diff --git a/helper/darwin.go b/helper/darwin.go
index 48caaa4..733eaf1 100644
--- a/helper/darwin.go
+++ b/helper/darwin.go
@@ -34,6 +34,8 @@ import (
"os/exec"
"path"
"strings"
+
+ "github.com/sevlyar/go-daemon"
)
const (
@@ -48,6 +50,28 @@ const (
pfctl = "/sbin/pfctl"
)
+func daemonize() {
+ cntxt := &daemon.Context{
+ PidFileName: "pid",
+ PidFilePerm: 0644,
+ LogFileName: "bitmask-helper.log",
+ LogFilePerm: 0640,
+ WorkDir: "./",
+ Umask: 027,
+ Args: []string{"[bitmask-helper]"},
+ }
+
+ d, err := cntxt.Reborn()
+ if err != nil {
+ log.Fatal("Unable to run: ", err)
+ }
+ if d != nil {
+ return
+ }
+ defer cntxt.Release()
+ log.Print("bitmask-helper daemon started")
+}
+
func getOpenvpnPath() string {
return openvpnPath
}
diff --git a/helper/helper.go b/helper/helper.go
index 4671868..0eea9c7 100644
--- a/helper/helper.go
+++ b/helper/helper.go
@@ -23,8 +23,6 @@ import (
"os"
"os/exec"
"runtime"
-
- "github.com/sevlyar/go-daemon"
)
const (
@@ -50,28 +48,6 @@ func main() {
}
-func daemonize() {
- cntxt := &daemon.Context{
- PidFileName: "pid",
- PidFilePerm: 0644,
- LogFileName: "bitmask-helper.log",
- LogFilePerm: 0640,
- WorkDir: "./",
- Umask: 027,
- Args: []string{"[bitmask-helper]"},
- }
-
- d, err := cntxt.Reborn()
- if err != nil {
- log.Fatal("Unable to run: ", err)
- }
- if d != nil {
- return
- }
- defer cntxt.Release()
- log.Print("bitmask-helper daemon started")
-}
-
func serveHTTP() {
openvpn := openvpnT{nil}
http.HandleFunc("/openvpn/start", openvpn.start)