waf: list its own endpoints on a chi router in routes.go (closes #426)
check / check (push) Failing after 3m37s
check / check (push) Failing after 3m37s
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 is contained in:
1 parent
51989235d6
commit
135b3ff224
9 files changed
+315
-195
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user