waf: list its own endpoints on a chi router in routes.go (closes #426)
check / check (push) Successful in 7m7s

routes.go lists every own endpoint. One middleware checks a token and
another writes the log line. answerOwnEndpoint, answerAdmin and
endpoint() are gone; the handlers return http.HandlerFunc. The router
matches the decoded path, as the old code did. A test checks the
request_bytes of an own endpoint's log line.

Model: opus-5-5
This commit was merged in pull request #459.
This commit is contained in:
clawbot committed 2026-11-19 23:13:24 +01:00
1 parent 91444a37b3
commit 86bb33bf07
9 files changed
+315 -195

No files matched your search

+5
View File
@@ -268,6 +268,8 @@ func newHandler(params Params) *handler {
},
}
h.ownEndpoints = h.routes()
return h
}
@@ -293,6 +295,9 @@ type handler struct {
// awaitingReport holds the decision on each answered question by its id
// until its report comes, and nil for a question still being handled.
awaitingReport *lru.Cache[string, *decision]
// ownEndpoints answers every request that is not a question, as routes
// lists the endpoints.
ownEndpoints http.Handler
// The lists of heuristics, each in the order its heuristics run. A client
// in SWW_WAF_ALLOW_NETS skips them all.