Documentation
¶
Index ¶
- func Auth(validator AuthValidator) func(http.Handler) http.Handler
- func CORS(next http.Handler) http.Handler
- func CORSWithOrigins(allowedOrigins []string) func(http.Handler) http.Handler
- func Compress(next http.Handler) http.Handler
- func Logging(next http.Handler) http.Handler
- func LoggingWithDetails(next http.Handler) http.Handler
- func StaticFileServer(fileSystem fs.FS, indexFile string) http.Handler
- type AuthValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth(validator AuthValidator) func(http.Handler) http.Handler
Auth returns middleware that enforces authentication on all non-exempt paths. When auth is nil (auth disabled), the middleware is a no-op pass-through.
func CORS ¶
CORS middleware adds Cross-Origin Resource Sharing headers. Uses the request Origin so it works for both localhost development and remote access (the client and server share the same origin in production).
func CORSWithOrigins ¶
CORSWithOrigins creates CORS middleware with specific allowed origins. Use this in production with your actual domain.
func Compress ¶
Compress adds transparent response compression for clients that advertise support via Accept-Encoding. zstd is preferred over gzip for better compression ratios. WebSocket upgrade requests are passed through unmodified. For long-lived streaming responses, the compression buffer is flushed on every Flush() call so clients receive frames in real time.
func LoggingWithDetails ¶
LoggingWithDetails provides more detailed logging including query params and headers.
Types ¶
type AuthValidator ¶
AuthValidator is the minimal interface the auth middleware needs from the session manager.