Give ban causes, limit kinds, alert events, actions and dispositions named types (closes #428)
check / check (push) Waiting to run
check / check (push) Waiting to run
Each fixed set of string constants becomes a named string type in the package that owns it, and the fields and parameters that carry it use the type: bans.Cause, ratelimit.LimitKind, alerts.Event, alerts.Destination, rules.Action, requestlog.Action, requestlog.Offence, requestlog.WAFLine and waf.Disposition. Every value keeps its string, so the logs, state files, alerts and metrics do not change. The switches exhaustive now checks list their missing cases. Model: opus-5-5
This commit is contained in:
1 parent
98d7432077
commit
fde205af50
41 files changed
+347
-239
No files matched your search
@@ -215,7 +215,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// This panic has Go's server close the connection without an answer,
|
||||
// and log nothing; the deferred finish still runs.
|
||||
panic(http.ErrAbortHandler)
|
||||
default: // a deny, an error, or an answer without a valid disposition
|
||||
case waf.DispositionDeny, "": // "" is an error, or no valid disposition
|
||||
rq.answerWith(answer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user