Give ban causes, limit kinds, alert events, actions and dispositions named types (closes #428)
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.DestinationName, rules.Action, requestlog.Action,
requestlog.Offence, requestlog.WAFLineKind and wafprotocol.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:
sneak committed 2026-11-19 22:13:39 +00:00
1 parent 86bb33bf07
commit de78a12801
43 files changed
+373 -255

No files matched your search

+3 -3
View File
@@ -72,9 +72,9 @@ const (
// What the stand-in for waf answers.
const (
dispositionAllow = wafprotocol.DispositionAllow
dispositionDeny = wafprotocol.DispositionDeny
dispositionClose = wafprotocol.DispositionClose
dispositionAllow = string(wafprotocol.DispositionAllow)
dispositionDeny = string(wafprotocol.DispositionDeny)
dispositionClose = string(wafprotocol.DispositionClose)
// deniedBody is the body of a deny.
deniedBody = "refused by waf"
)