Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPServerModule ¶
Types ¶
type BulkheadConfig ¶
type Config ¶
type Config struct {
Port int `mapstructure:"port"`
// Server connection settings
Connection ConnectionConfig `mapstructure:"connection"`
// Request Timeout (middleware-based, returns proper HTTP response)
Timeout TimeoutConfig `mapstructure:"timeout"`
// Rate Limiting
RateLimit RateLimitConfig `mapstructure:"rate-limit"`
// HTTP Bulkhead
Bulkhead BulkheadConfig `mapstructure:"bulkhead"`
}
type ConnectionConfig ¶
type ConnectionConfig struct {
ReadHeaderTimeout time.Duration `mapstructure:"read-header-timeout"` // Time to read request headers (Slowloris protection)
ReadTimeout time.Duration `mapstructure:"read-timeout"` // Time to read entire request (headers + body)
WriteTimeout time.Duration `mapstructure:"-"` // Auto-calculated, not configurable
IdleTimeout time.Duration `mapstructure:"idle-timeout"` // Keep-alive timeout between requests
MaxHeaderBytes int `mapstructure:"max-header-bytes"` // Max size of request headers
}
ConnectionConfig contains low-level HTTP server connection settings. These are "hard" timeouts that close the connection without HTTP response.
Note: WriteTimeout is intentionally not configurable. It is automatically calculated as RequestTimeout + buffer to ensure the timeout middleware can send a proper HTTP response before the connection is closed.
type RateLimitConfig ¶
type TimeoutConfig ¶
type TimeoutConfig struct {
RequestTimeout time.Duration `mapstructure:"request-timeout"` // Max time to handle a request (0 = disabled)
}
TimeoutConfig controls the middleware-based request timeout. Unlike connection timeouts, this returns a proper HTTP 503 response. Timeout is enabled when RequestTimeout > 0.
Click to show internal directories.
Click to hide internal directories.