Documentation
¶
Index ¶
- Variables
- func BotChallengeHandler(w http.ResponseWriter, r *http.Request)
- func BotDefense(next http.Handler) http.Handler
- func HostDispatcher(next http.Handler) http.Handler
- func IPBlocker(next http.Handler) http.Handler
- func InjectAuthToScope(r *http.Request, scope interface{})
- func MultiTenantAuth(jwtSecret string) func(http.Handler) http.Handler
- func Recoverer(next http.Handler) http.Handler
- func SecurityHeaders(next http.Handler) http.Handler
- func WAF(next http.Handler) http.Handler
- type IPBlockList
Constants ¶
This section is empty.
Variables ¶
var GlobalBlockList = &IPBlockList{ blocked: make(map[string]bool), }
Functions ¶
func BotChallengeHandler ¶
func BotChallengeHandler(w http.ResponseWriter, r *http.Request)
BotChallengeHandler handles the POST request from the challenge page
func BotDefense ¶
BotDefense implements a simple JS challenge to stop basic bots
func HostDispatcher ¶
HostDispatcher performs an O(1) lookup to route requests based on the Host header. This is much more efficient than linear middleware checks for environments with many domains.
func InjectAuthToScope ¶
InjectAuthToScope injects auth data from HTTP context into ZenoLang scope This should be called in createHandler before executing ZenoLang code
func MultiTenantAuth ¶
MultiTenantAuth is a Chi middleware that handles multi-tenant authentication It auto-detects tenant from X-Tenant-ID header or subdomain, validates JWT token, and sets auth context for downstream handlers
func SecurityHeaders ¶
SecurityHeaders adds "Helmet"-like security headers
Types ¶
type IPBlockList ¶
type IPBlockList struct {
// contains filtered or unexported fields
}
IPBlockList manages blocked IPs safely
func (*IPBlockList) IsBlocked ¶
func (b *IPBlockList) IsBlocked(ip string) bool
IsBlocked checks if an IP is in the blocklist
func (*IPBlockList) Load ¶
func (b *IPBlockList) Load()
LoadBlockList initializes the blocklist from Env and File