aboutsummaryrefslogtreecommitdiff
path: root/lib/anubis.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/anubis.go')
-rw-r--r--lib/anubis.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/anubis.go b/lib/anubis.go
index c61b110..939262a 100644
--- a/lib/anubis.go
+++ b/lib/anubis.go
@@ -241,6 +241,10 @@ func (s *Server) MaybeReverseProxy(w http.ResponseWriter, r *http.Request) {
return
case config.RuleChallenge:
lg.Debug("challenge requested")
+ case config.RuleBenchmark:
+ lg.Debug("serving benchmark page")
+ s.RenderBench(w, r)
+ return
default:
s.ClearCookie(w)
templ.Handler(web.Base("Oh noes!", web.ErrorPage("Other internal server error (contact the admin)")), templ.WithStatus(http.StatusInternalServerError)).ServeHTTP(w, r)
@@ -334,6 +338,12 @@ func (s *Server) RenderIndex(w http.ResponseWriter, r *http.Request) {
handler.ServeHTTP(w, r)
}
+func (s *Server) RenderBench(w http.ResponseWriter, r *http.Request) {
+ templ.Handler(
+ web.Base("Benchmarking Anubis!", web.Bench()),
+ ).ServeHTTP(w, r)
+}
+
func (s *Server) MakeChallenge(w http.ResponseWriter, r *http.Request) {
lg := slog.With("user_agent", r.UserAgent(), "accept_language", r.Header.Get("Accept-Language"), "priority", r.Header.Get("Priority"), "x-forwarded-for", r.Header.Get("X-Forwarded-For"), "x-real-ip", r.Header.Get("X-Real-Ip"))