Module middleware

Module middleware 

Source
Expand description

HTTP Middleware for IPFRS Gateway

Provides:

  • Authentication and authorization middleware using JWT tokens and API keys
  • CORS middleware for cross-origin requests
  • Rate limiting middleware for DoS prevention
  • Compression middleware for bandwidth optimization
  • Caching middleware for HTTP caching headers

Structs§

AuthMiddlewareError
Middleware error wrapper
AuthUser
Authenticated user context
CacheConfig
Cache configuration
CompressionConfig
Compression configuration
CorsConfig
CORS configuration
CorsState
CORS middleware state
RateLimitConfig
Rate limiter configuration
RateLimitState
Rate limiter state (per-IP buckets)
ValidationConfig
Request validation configuration
ValidationState
Validation middleware state

Enums§

CompressionLevel
Compression level - balances speed vs compression ratio
RateLimitError
Rate limit error
ValidationError
Validation error types

Functions§

add_caching_headers
Add caching headers to a response for a given CID
auth_middleware
Authentication middleware
check_etag_match
Check if request has a matching ETag (for conditional requests)
cors_middleware
CORS middleware
not_modified_response
Build a 304 Not Modified response
rate_limit_middleware
Rate limiting middleware
require_permission
Authorization middleware factory
validate_batch_size
Validate batch size
validate_cid
Validate CID format
validate_content_type
Validate content type
validation_middleware
Request validation middleware