mirror of
https://github.com/Sean-Der/fail2rest.git
synced 2024-12-22 21:52:18 +01:00
A jail's actions are now return in its top level handler
This commit is contained in:
parent
9119ebb08e
commit
4d84eda7db
1 changed files with 12 additions and 9 deletions
9
jail.go
9
jail.go
|
@ -3,12 +3,13 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Sean-Der/fail2go"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Sean-Der/fail2go"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) {
|
func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) {
|
||||||
|
@ -22,6 +23,7 @@ func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fai
|
||||||
findTime, _ := fail2goConn.JailFindTime(mux.Vars(req)["jail"])
|
findTime, _ := fail2goConn.JailFindTime(mux.Vars(req)["jail"])
|
||||||
useDNS, _ := fail2goConn.JailUseDNS(mux.Vars(req)["jail"])
|
useDNS, _ := fail2goConn.JailUseDNS(mux.Vars(req)["jail"])
|
||||||
maxRetry, _ := fail2goConn.JailMaxRetry(mux.Vars(req)["jail"])
|
maxRetry, _ := fail2goConn.JailMaxRetry(mux.Vars(req)["jail"])
|
||||||
|
actions, _ := fail2goConn.JailActions(mux.Vars(req)["jail"])
|
||||||
|
|
||||||
if IPList == nil {
|
if IPList == nil {
|
||||||
IPList = []string{}
|
IPList = []string{}
|
||||||
|
@ -40,7 +42,8 @@ func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fai
|
||||||
"failRegexes": failRegexes,
|
"failRegexes": failRegexes,
|
||||||
"findTime": findTime,
|
"findTime": findTime,
|
||||||
"useDNS": useDNS,
|
"useDNS": useDNS,
|
||||||
"maxRetry": maxRetry})
|
"maxRetry": maxRetry,
|
||||||
|
"actions": actions})
|
||||||
res.Write(encodedOutput)
|
res.Write(encodedOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue