summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/http.go b/http.go
index b884187..d478fff 100644
--- a/http.go
+++ b/http.go
@@ -23,7 +23,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("Got URL Path: ", r.URL.Path)
route := cleanURL(r.URL.Path)
- domname := r.URL.Query().Get("domain")
+ // domname := r.URL.Query().Get("domain")
flag := r.URL.Query().Get("flag")
msg, err := ioutil.ReadAll(r.Body) // Read the body as []byte
@@ -38,12 +38,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
- // exit the virtigo daemon & have systemd restart it
- // this can happen & when it does, access to
- // to libvirtd will hang (aka: virsh list will hang)
- // One way to trigger this is to not properly close
- // domain sockets opened from go-qemu/hypervisor
- // it's a good idea in any case so leave it here
+ // exit gus
if route == "/kill" {
log.Warn("KILLED")
fmt.Fprintln(w, "KILLED")
@@ -51,10 +46,18 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
- // curl http://localhost:2520/import?domain=foo.bar.com
- if route == "/import" {
- fmt.Fprint(w, "import domain:", domname)
-
+ if route == "/list" {
+ all := me.portmaps.All()
+ for all.Scan() {
+ pm := all.Next()
+ if !pm.Enabled {
+ continue
+ }
+ s := fmt.Sprintf("portmap enabled for port %d to %s", pm.Listen, pm.Connect)
+ log.Info(s)
+ fmt.Fprintln(w, s)
+ }
+ startHTTP()
return
}