Documentation
¶
Overview ¶
Package delivery provides opt-in, at-least-once webhook delivery. Receivers must deduplicate Idempotency-Key; a crash after acceptance can repeat a POST.
Index ¶
Constants ¶
const MaxEntries = 10000
Variables ¶
var ErrFull = errors.New("alert outbox capacity reached (including idempotency receipts)")
Functions ¶
This section is empty.
Types ¶
type Notice ¶
type Notice struct {
Version string `json:"version"`
Scope string `json:"scope"`
Timestamp int64 `json:"timestamp,string"`
Rule string `json:"rule"`
Severity string `json:"severity"`
RecordType string `json:"recordType"`
RuleDigest string `json:"ruleDigest"`
RecordDigest string `json:"recordDigest"`
SrcIP string `json:"srcIP"`
DstIP string `json:"dstIP"`
}
Notice intentionally excludes raw records, expressions, notes, descriptions, tags and authentication material. Scope is supplied by the capture owner.
type Outbox ¶
type Outbox struct {
// contains filtered or unexported fields
}
func Open ¶
Open pins a private database to one destination. Credentials belong in the runtime request header, never the URL or persisted queue. No worker is spawned.
func (*Outbox) Deliver ¶
Deliver attempts at most limit currently-due notices, serially. Retry delays are persisted (1s exponential backoff, capped at 1h). 408/425/429/5xx and transport errors retry; other non-2xx responses retain rejected receipts. token is read by the caller at runtime and is never stored or returned.
type Status ¶
type Status struct {
Pending int `json:"pending"`
Delivered int `json:"delivered"`
Rejected int `json:"rejected"`
}
func (Status) RequireDrained ¶
RequireDrained distinguishes a persisted retry backlog from delivery success.
type Writer ¶
type Writer struct {
Audit AlertWriter
Outbox *Outbox
Scope string
}
Writer retains the audit first, then commits a redacted delivery notice. A failed enqueue returns an error; the durable audit can be re-enqueued later. Close does not deliver or discard pending notices and does not own the outbox.