summaryrefslogtreecommitdiff
path: root/pkg/helper/helper.go
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-02-17 17:13:25 +0100
committerkali kaneko (leap communications) <kali@leap.se>2020-04-30 22:10:15 +0200
commit75b26ec7f4f001a13db2c8dd1fa02d7481fd2b72 (patch)
tree555134c02f5cfcf22f3060fac59bf51fe8a64f1a /pkg/helper/helper.go
parentaf04003d9e37ef4a08c29e967962df40d2541660 (diff)
[feat] initial implementation of windows service
Diffstat (limited to 'pkg/helper/helper.go')
-rw-r--r--pkg/helper/helper.go9
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 {