fail2go pkg renamed Fail2goConn -> Conn so fully qualified name would just read fail2go.Conn

This commit is contained in:
Sean DuBois 2014-06-27 06:58:35 +00:00
parent 1f93c63ea1
commit 6ac04f33cf
3 changed files with 13 additions and 13 deletions

View File

@ -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")

View File

@ -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")

18
jail.go
View File

@ -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)