Add lifecycle hooks so users can react to rate-limit and ban events.
Suggested hooks:
onRateLimitExceeded(ip, path, count) — called when a request exceeds the limit (before ban is set)
onBan(ip, path, duration) — called when an IP is banned
onBannedRequest(ip, path) — called when a banned IP attempts a request
Use cases:
- Send Slack/Discord alerts on repeat offenders
- Push metrics to Prometheus/StatsD
- Write to a custom audit log
- Trigger external firewall rules (e.g., Cloudflare API block)
Add lifecycle hooks so users can react to rate-limit and ban events.
Suggested hooks:
onRateLimitExceeded(ip, path, count)— called when a request exceeds the limit (before ban is set)onBan(ip, path, duration)— called when an IP is bannedonBannedRequest(ip, path)— called when a banned IP attempts a requestUse cases: