Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBulkheadFull = errors.New("too many concurrent requests")
ErrBulkheadFull is returned when bulkhead is full.
var ErrPanic = errors.New("internal server error")
ErrPanic is returned when a panic is recovered.
var ErrRateLimitExceeded = errors.New("rate limit exceeded")
ErrRateLimitExceeded is returned when rate limit is exceeded.
var ErrRequestTimeout = errors.New("request timeout")
ErrRequestTimeout is returned when request times out.
Functions ¶
func HTTPBulkheadModule ¶
HTTPBulkheadModule adds HTTP bulkhead middleware to the application.
func LoggerModule ¶
LoggerModule provides logger middleware.
func NewOgenMiddlewareModule ¶ added in v0.2.5
NewOgenMiddlewareModule provides all ogen middleware modules. Middleware execution order (by priority, lower = earlier):
10 - Recovery - catches panics (must be first) 20 - Logger - logs all requests 30 - Timeout - kills hanging requests 40 - RateLimit - limits requests/second 50 - HTTPBulkhead - limits concurrent requests
Note: ErrorLogger and Problem middlewares are not needed with ogen - use OgenErrorHandler which handles both logging and RFC 7807 responses.
func RateLimitModule ¶
RateLimitModule adds rate limiting middleware to the application.
func RecoveryModule ¶
RecoveryModule provides recovery middleware.
func TimeoutModule ¶
TimeoutModule adds timeout middleware to the application.
Types ¶
type Middleware ¶
type Middleware struct {
Priority int
Handler middleware.Middleware
}
Middleware represents an ogen middleware with priority.