middleware

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middleware for per-IP rate limiting and structured request logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP extracts the client IP address from the request.

func GenerateRequestID

func GenerateRequestID() string

GenerateRequestID creates a short random hex string for request correlation.

func Logging

func Logging(next http.Handler) http.Handler

Logging is HTTP middleware that logs each request with method, path, status code, duration, bytes written, and client IP. It uses httpsnoop to correctly capture the response status without breaking optional http.ResponseWriter interfaces (Flusher, Hijacker, etc.).

func RateLimit

func RateLimit(store limiter.Store, next http.Handler) http.Handler

RateLimit returns middleware that enforces per-IP rate limiting using the provided limiter store.

Types

This section is empty.

Jump to

Keyboard shortcuts

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