middleware

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPAllowlist

func IPAllowlist(allowedCIDRs []string, next http.Handler) (http.Handler, error)

IPAllowlist restricts access to requests from configured CIDR ranges. Loopback addresses are always allowed for local administration. Empty CIDR list means no restriction.

func JSONContentType

func JSONContentType(next http.Handler) http.Handler

JSONContentType sets the Content-Type header to application/json for API requests handled by the wrapped handler. SSE endpoints (text/event-stream) are excluded.

func Logger

func Logger(next http.Handler) http.Handler

Logger logs each HTTP request with method, path, status code, and duration.

func Recoverer

func Recoverer(next http.Handler) http.Handler

Recoverer recovers from panics in downstream handlers and returns a 500 Internal Server Error response.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL