From 6ac04f33cf4be0f6b1b1909a30e560857c63efc4 Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Fri, 27 Jun 2014 06:58:35 +0000 Subject: [PATCH] fail2go pkg renamed Fail2goConn -> Conn so fully qualified name would just read fail2go.Conn --- fail2rest.go | 2 +- global.go | 6 +++--- jail.go | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fail2rest.go b/fail2rest.go index 73f2ebd..4c98925 100644 --- a/fail2rest.go +++ b/fail2rest.go @@ -18,7 +18,7 @@ type ErrorBody struct { Error string } -var fail2goConn *fail2go.Fail2goConn +var fail2goConn *fail2go.Conn func main() { file, fileErr := os.Open("config.json") diff --git a/global.go b/global.go index 56c6756..b52f767 100644 --- a/global.go +++ b/global.go @@ -7,7 +7,7 @@ import ( "net/http" ) -func globalStatusHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func globalStatusHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { globalStatus, _ := fail2goConn.GlobalStatus() encodedOutput, err := json.Marshal(globalStatus) @@ -17,7 +17,7 @@ func globalStatusHandler(res http.ResponseWriter, req *http.Request, fail2goConn res.Write(encodedOutput) } -func globalPingHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func globalPingHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { globalPing, _ := fail2goConn.GlobalPing() encodedOutput, err := json.Marshal(globalPing) @@ -28,7 +28,7 @@ func globalPingHandler(res http.ResponseWriter, req *http.Request, fail2goConn * } -func globalHandler(globalRouter *mux.Router, fail2goConn *fail2go.Fail2goConn) { +func globalHandler(globalRouter *mux.Router, fail2goConn *fail2go.Conn) { globalRouter.HandleFunc("/status", func(res http.ResponseWriter, req *http.Request) { globalStatusHandler(res, req, fail2goConn) }).Methods("GET") diff --git a/jail.go b/jail.go index 679ea37..18e5a9a 100644 --- a/jail.go +++ b/jail.go @@ -7,7 +7,7 @@ import ( "net/http" ) -func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { currentlyFailed, totalFailed, fileList, currentlyBanned, totalBanned, IPList, _ := fail2goConn.JailStatus(mux.Vars(req)["jail"]) failRegexes, _ := fail2goConn.JailFailRegex(mux.Vars(req)["jail"]) findTime, _ := fail2goConn.JailFindTime(mux.Vars(req)["jail"]) @@ -36,7 +36,7 @@ type jailBanIPBody struct { IP string } -func jailBanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailBanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailBanIPBody err := json.NewDecoder(req.Body).Decode(&input) if err != nil { @@ -51,7 +51,7 @@ func jailBanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn *f res.Write(encodedOutput) } -func jailUnbanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailUnbanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailBanIPBody err := json.NewDecoder(req.Body).Decode(&input) if err != nil { @@ -70,7 +70,7 @@ type jailFailRegexBody struct { FailRegex string } -func jailAddFailRegexHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailAddFailRegexHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailFailRegexBody var encodedOutput []byte @@ -93,7 +93,7 @@ func jailAddFailRegexHandler(res http.ResponseWriter, req *http.Request, fail2go res.Write(encodedOutput) } -func jailDeleteFailRegexHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailDeleteFailRegexHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailFailRegexBody err := json.NewDecoder(req.Body).Decode(&input) if err != nil { @@ -112,7 +112,7 @@ type jailFindTimeBody struct { FindTime int } -func jailSetFindTimeHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailSetFindTimeHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailFindTimeBody err := json.NewDecoder(req.Body).Decode(&input) @@ -135,7 +135,7 @@ type jailUseDNSBody struct { UseDNS string } -func jailSetUseDNSHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailSetUseDNSHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailUseDNSBody err := json.NewDecoder(req.Body).Decode(&input) @@ -158,7 +158,7 @@ type jailMaxRetryBody struct { MaxRetry int } -func jailSetMaxRetryHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Fail2goConn) { +func jailSetMaxRetryHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fail2go.Conn) { var input jailMaxRetryBody err := json.NewDecoder(req.Body).Decode(&input) @@ -178,7 +178,7 @@ func jailSetMaxRetryHandler(res http.ResponseWriter, req *http.Request, fail2goC } -func jailHandler(jailRouter *mux.Router, fail2goConn *fail2go.Fail2goConn) { +func jailHandler(jailRouter *mux.Router, fail2goConn *fail2go.Conn) { jailRouter.HandleFunc("/{jail}/bannedip", func(res http.ResponseWriter, req *http.Request) { jailBanIPHandler(res, req, fail2goConn)