Add dl_map endpoint
This commit is contained in:
parent
fb0c46ee34
commit
d75188848a
11
http.go
11
http.go
|
@ -87,3 +87,14 @@ func reloadHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
|
||||
func dlMapHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if dlMap == nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
json.NewEncoder(w).Encode(dlMap)
|
||||
}
|
||||
|
|
1
main.go
1
main.go
|
@ -124,6 +124,7 @@ func main() {
|
|||
mux.HandleFunc("/status", statusHandler)
|
||||
mux.HandleFunc("/mirrors", mirrorsHandler)
|
||||
mux.HandleFunc("/reload", reloadHandler)
|
||||
mux.HandleFunc("/dl_map", dlMapHandler)
|
||||
mux.HandleFunc("/", RealIPMiddleware(redirectHandler))
|
||||
|
||||
http.ListenAndServe(viper.GetString("bind"), mux)
|
||||
|
|
Loading…
Reference in New Issue