Better URL scheme for manipulating bannedips, now just have single dir that you can POST or DELETE to

This commit is contained in:
Sean DuBois 2014-06-20 06:30:18 +00:00
parent 67aa38de0d
commit 149fb451a6

View file

@ -63,12 +63,14 @@ func jailUnbanIPHandler(res http.ResponseWriter, req *http.Request, fail2goConn
} }
func jailHandler(jailRouter *mux.Router, fail2goConn *fail2go.Fail2goConn) { func jailHandler(jailRouter *mux.Router, fail2goConn *fail2go.Fail2goConn) {
jailRouter.HandleFunc("/{jail}/banip", func(res http.ResponseWriter, req *http.Request) {
jailRouter.HandleFunc("/{jail}/bannedips", func(res http.ResponseWriter, req *http.Request) {
jailBanIPHandler(res, req, fail2goConn) jailBanIPHandler(res, req, fail2goConn)
}).Methods("POST") }).Methods("POST")
jailRouter.HandleFunc("/{jail}/unbanip", func(res http.ResponseWriter, req *http.Request) { jailRouter.HandleFunc("/{jail}/bannedips", func(res http.ResponseWriter, req *http.Request) {
jailUnbanIPHandler(res, req, fail2goConn) jailUnbanIPHandler(res, req, fail2goConn)
}).Methods("POST") }).Methods("DELETE")
jailRouter.HandleFunc("/{jail}", func(res http.ResponseWriter, req *http.Request) { jailRouter.HandleFunc("/{jail}", func(res http.ResponseWriter, req *http.Request) {
jailGetHandler(res, req, fail2goConn) jailGetHandler(res, req, fail2goConn)
}).Methods("GET") }).Methods("GET")