mirror of
https://github.com/Sean-Der/fail2rest.git
synced 2025-01-03 11:22:13 +01:00
Rename global->basic for route, this more closely models the fail2ban-client documentation
This commit is contained in:
parent
3c3efd4449
commit
de2a4e62f0
2 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GlobalStatusHandler(res http.ResponseWriter, req *http.Request) {
|
func BasicStatusHandler(res http.ResponseWriter, req *http.Request) {
|
||||||
fail2banInput := make([]string, 1)
|
fail2banInput := make([]string, 1)
|
||||||
fail2banInput[0] = "status"
|
fail2banInput[0] = "status"
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func GlobalStatusHandler(res http.ResponseWriter, req *http.Request) {
|
||||||
res.Write(encodedOutput)
|
res.Write(encodedOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GlobalPingHandler(res http.ResponseWriter, req *http.Request) {
|
func BasicPingHandler(res http.ResponseWriter, req *http.Request) {
|
||||||
fail2banInput := make([]string, 1)
|
fail2banInput := make([]string, 1)
|
||||||
fail2banInput[0] = "ping"
|
fail2banInput[0] = "ping"
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ func GlobalPingHandler(res http.ResponseWriter, req *http.Request) {
|
||||||
res.Write(encodedOutput)
|
res.Write(encodedOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GlobalHandler(globalRouter *mux.Router) {
|
func BasicHandler(basicRouter *mux.Router) {
|
||||||
globalRouter.HandleFunc("/status", GlobalStatusHandler).Methods("GET")
|
basicRouter.HandleFunc("/status", BasicStatusHandler).Methods("GET")
|
||||||
globalRouter.HandleFunc("/ping", GlobalPingHandler).Methods("GET")
|
basicRouter.HandleFunc("/ping", BasicPingHandler).Methods("GET")
|
||||||
}
|
}
|
2
main.go
2
main.go
|
@ -29,7 +29,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
GlobalHandler(r.PathPrefix("/global").Subrouter())
|
BasicHandler(r.PathPrefix("/basic").Subrouter())
|
||||||
http.Handle("/", r)
|
http.Handle("/", r)
|
||||||
http.ListenAndServe(configuration.Addr, nil)
|
http.ListenAndServe(configuration.Addr, nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue