diff options
| author | Jeff Carr <[email protected]> | 2025-03-11 08:50:57 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-11 12:16:21 -0500 |
| commit | 09e7dfbb2b34f5281bc3fef0b02c13db714db212 (patch) | |
| tree | 5d2bfd65fe9ab1af6dd47bc583cf5739a448a8e1 /http.go | |
| parent | 92f8b4270626cb9c417bda005300e99ea2e71a45 (diff) | |
onward
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -8,6 +8,7 @@ import ( "io/ioutil" "net/http" "os" + "strconv" "strings" "go.wit.com/log" @@ -48,19 +49,21 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - if route == "/list" { - all := me.portmaps.All() - for all.Scan() { - pm := all.Next() - if !pm.Enabled { - continue + /* + 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) } - s := fmt.Sprintf("portmap enabled for port %d to %s", pm.Listen, pm.Connect) - log.Info(s) - fmt.Fprintln(w, s) + return } - return - } + */ if route == "/save" { log.Info("event log is len =", me.events.Len()) @@ -71,14 +74,17 @@ func okHandler(w http.ResponseWriter, r *http.Request) { if route == "/enable" { log.HttpMode(w) defer log.HttpMode(nil) - log.Info("enable port/dest", port, dest) + num, _ := strconv.Atoi(port) + log.Info("enable port =", num, "dest =", dest) + enablePort(num, dest) return } if route == "/disable" { log.HttpMode(w) defer log.HttpMode(nil) - log.Info("enable port/dest", port, dest) + num, _ := strconv.Atoi(port) + log.Info("disable port =", num, "dest =", dest) return } |
