Add dl_map endpoint
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Tyler 2022-01-10 00:15:07 -05:00
parent fb0c46ee34
commit d75188848a
2 changed files with 12 additions and 0 deletions

11
http.go
View File

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

View File

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