check / check (push) Waiting to run
SWWAF_ALERT_WEBHOOK_URL gets one JSON POST per alert, in SPEC.md's schema, with SWWAF_ALERT_WEBHOOK_HEADERS: ban and permanent_ban, with the ban's notes; source_failure for GeoJS; file_error for a rule or state file edit that does not parse and a failed state write. SWWAF_ALERT_EVENTS chooses, SWWAF_ALERT_COOLDOWN holds back repeats, and past SWWAF_ALERT_MAX_PER_HOUR the hour ends in one summary. A bounded queue, retried with backoff, holds up no request; alerts.json keeps it, the cooldowns and the hour. The ledger now reports whether it made a ban, or made one permanent. Judgement call: the summary's event is summary, which SPEC.md omits. Judgement call: admin bans and observe mode raise no alert. Model: opus-5-5
13 lines
312 B
Go
13 lines
312 B
Go
package alerts
|
|
|
|
import "net/http"
|
|
|
|
// QueueSize is the most alerts that wait to be sent.
|
|
const QueueSize = queueSize
|
|
|
|
// SetTransport has q's requests to the webhook go through transport
|
|
// instead of the network.
|
|
func (q *Queue) SetTransport(transport http.RoundTripper) {
|
|
q.httpClient.Transport = transport
|
|
}
|