Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
func (*Backend) GetService ¶ added in v1.6.0
GetService returns a single service (backward compatibility method) Returns the first server if in multi-server mode
func (*Backend) IsMultiServer ¶ added in v1.6.0
IsMultiServer checks if the backend is configured for multi-server mode
func (*Backend) Normalize ¶ added in v1.6.0
func (b *Backend) Normalize() *NormalizedBackend
Normalize converts the Backend to a NormalizedBackend If only a single Service is configured, it automatically converts to multi-server mode
type NormalizedBackend ¶ added in v1.6.0
type NormalizedBackend struct {
Algorithm string
Servers []*service.Server
BaseConfig *service.Service
}
NormalizedBackend represents a normalized backend configuration that can handle both single-server and multi-server modes
type RateLimit ¶ added in v1.7.0
type RateLimit struct {
Enable bool `config:"enable"`
Algorithm string `config:"algorithm,default=token-bucket"` // token-bucket, leaky-bucket, fixed-window
KeyType string `config:"key_type,default=ip"` // ip, user, apikey, clientid, header
KeyHeader string `config:"key_header"` // when key_type=header, specify header name
Limit int64 `config:"limit"` // limit count
Window int64 `config:"window"` // time window in seconds
Burst int64 `config:"burst"` // burst capacity (only for token-bucket)
Message string `config:"message,default=Too Many Requests"`
Headers map[string]string `config:"headers"` // custom response headers
}
Click to show internal directories.
Click to hide internal directories.