@@ -203,6 +203,18 @@ func jailSetMaxRetryHandler(res http.ResponseWriter, req *http.Request, fail2goC
203
203
res .Write (encodedOutput )
204
204
}
205
205
206
+ func jailActionHandler (res http.ResponseWriter , req * http.Request , fail2goConn * fail2go.Conn ) {
207
+ port , err := fail2goConn .JailActionProperty (mux .Vars (req )["jail" ], mux .Vars (req )["action" ], "port" )
208
+ if err != nil {
209
+ writeHTTPError (res , err )
210
+ return
211
+ }
212
+
213
+ encodedOutput , _ := json .Marshal (map [string ]interface {}{
214
+ "port" : port })
215
+ res .Write (encodedOutput )
216
+ }
217
+
206
218
func jailHandler (jailRouter * mux.Router , fail2goConn * fail2go.Conn ) {
207
219
208
220
jailRouter .HandleFunc ("/{jail}/bannedip" , func (res http.ResponseWriter , req * http.Request ) {
@@ -235,6 +247,10 @@ func jailHandler(jailRouter *mux.Router, fail2goConn *fail2go.Conn) {
235
247
jailSetMaxRetryHandler (res , req , fail2goConn )
236
248
}).Methods ("POST" )
237
249
250
+ jailRouter .HandleFunc ("/{jail}/action/{action}" , func (res http.ResponseWriter , req * http.Request ) {
251
+ jailActionHandler (res , req , fail2goConn )
252
+ }).Methods ("GET" )
253
+
238
254
jailRouter .HandleFunc ("/{jail}" , func (res http.ResponseWriter , req * http.Request ) {
239
255
jailGetHandler (res , req , fail2goConn )
240
256
}).Methods ("GET" )
0 commit comments