diff options
Diffstat (limited to 'pkg/helper/helper.go')
-rw-r--r-- | pkg/helper/helper.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/helper/helper.go b/pkg/helper/helper.go index 2e7ffd1..ab1894e 100644 --- a/pkg/helper/helper.go +++ b/pkg/helper/helper.go @@ -26,8 +26,7 @@ type openvpnT struct { cmd *exec.Cmd } -func ServeHTTP(bindAddr string) { - daemonize() +func runCommandServer(bindAddr string) { openvpn := openvpnT{nil} http.HandleFunc("/openvpn/start", openvpn.start) http.HandleFunc("/openvpn/stop", openvpn.stop) @@ -38,6 +37,12 @@ func ServeHTTP(bindAddr string) { log.Fatal(http.ListenAndServe(bindAddr, nil)) } +func ServeHTTP(bindAddr string) { + parseCliArgs() + daemonize() + doHandleCommands(bindAddr) +} + func (openvpn *openvpnT) start(w http.ResponseWriter, r *http.Request) { args, err := getArgs(r) if err != nil { |