Versions in this module Expand all Collapse all v1 v1.0.0 Dec 14, 2025 Changes in this version + const AdminKeyHeader + func AccessLog(log *slog.Logger, next http.Handler) http.Handler + func CircuitBreak(b *CircuitBreaker, next http.Handler) http.Handler + func ConcurrencyLimit(sem *Semaphore, next http.Handler) http.Handler + func Instrument(m *Metrics, next http.Handler) http.Handler + func MaxBodyBytes(limit int64, next http.Handler) http.Handler + func OptionalAuth(auth AuthHandler, next http.Handler) http.Handler + func RID(ctx context.Context) string + func RateLimit(limiter ratelimit.Limiter, ipr IPResolver, cfg RateLimitConfig, ...) http.Handler + func Recover(next http.Handler) http.Handler + func RequestID(next http.Handler) http.Handler + func RequireAdminKey(adminKey string, next http.Handler) http.Handler + func RequireAuth(auth AuthHandler, next http.Handler) http.Handler + func RouteName(ctx context.Context) string + func Subject(ctx context.Context) (string, bool) + func WithRoute(next http.Handler, routeName string) http.Handler + func WithSubject(next http.Handler, sub string) http.Handler + type AuthHandler interface + ValidateBearer func(r *http.Request) (string, error) + type Authenticator struct + HMACSecret []byte + JWKS *JWKSValidator + Mode string + func (a Authenticator) ValidateBearer(r *http.Request) (string, error) + type BreakerConfig struct + Enabled bool + FailureThreshold int + HalfOpenMaxInFlight int + OpenDuration time.Duration + type BreakerState string + const BreakerClosed + const BreakerHalfOpen + const BreakerOpen + type BreakerStats struct + Failures int + HalfInFlight int + OpensAt time.Time + RetryAfterSec int + State BreakerState + type CircuitBreaker struct + func NewCircuitBreaker(cfg BreakerConfig) *CircuitBreaker + func (b *CircuitBreaker) Stats() BreakerStats + type IPResolver struct + Trusted *netx.CIDRSet + func (r IPResolver) ClientIP(req *http.Request) string + type JWKSStats struct + FetchedAt time.Time + KeyCount int + URL string + type JWKSValidator struct + func NewJWKSValidator(url string, opts JWKSValidatorOptions) (*JWKSValidator, error) + func (j *JWKSValidator) Stats() JWKSStats + func (j *JWKSValidator) Validate(ctx context.Context, tokenStr string) (string, error) + type JWKSValidatorOptions struct + Audiences []string + CacheTTL time.Duration + HTTPTimeout time.Duration + Issuers []string + Leeway time.Duration + ValidAlgs []string + type Metrics struct + Latency *prometheus.HistogramVec + Requests *prometheus.CounterVec + func NewMetrics(reg prometheus.Registerer) *Metrics + type RateLimitConfig struct + Burst float64 + Enabled bool + RPS float64 + RouteName string + Scope string + type Semaphore struct + func NewSemaphore(maxInFlight int) *Semaphore + func (s *Semaphore) Cap() int + func (s *Semaphore) Enabled() bool + func (s *Semaphore) InUse() int + func (s *Semaphore) Release() + func (s *Semaphore) TryAcquire() bool