Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CORSConfig ¶ added in v0.25.3
type CORSConfig struct {
Enabled bool
AllowedOrigins []string
AllowedHeaders []string
AllowedMethods []string
}
func DefaultCORSConfig ¶ added in v0.25.3
func DefaultCORSConfig() CORSConfig
type Config ¶ added in v0.5.0
type Config struct {
Address string
Port string
SkipAuth bool
CORS CORSConfig
TLSEnabled bool
TLSCertPath string
TLSKeyPath string
RateLimit RateLimitConfig
}
func DefaultConfig ¶ added in v0.5.0
func DefaultConfig() Config
func (*Config) RequestURL ¶ added in v0.14.0
type RateLimitConfig ¶
type RateLimitConfig struct {
Enabled bool
// RequestsPerSec is the sustained per-IP request rate; requests above
// this rate (after burst is drained) get 429 Too Many Requests.
RequestsPerSec int
// Burst is the per-IP burst allowance — the bucket size that absorbs
// short spikes before sustained rate kicks in.
Burst int
// CacheSize is the max number of per-IP buckets retained.
// When exceeded, the least-recently-seen IP is evicted (and gets a fresh
// burst on its next request). Bounds memory under unique-IP floods.
CacheSize int
}
RateLimitConfig configures per-IP rate limiting on the RPC server. The limit is keyed by the connection's remote address, so behind a reverse proxy all clients share a single bucket — keep this disabled in that setup and apply rate limiting at the proxy instead.
func DefaultRateLimitConfig ¶
func DefaultRateLimitConfig() RateLimitConfig
DefaultRateLimitConfig disables rate limiting by default; production deployments typically run behind a reverse proxy that handles rate limiting correctly (with the real client IP).
Click to show internal directories.
Click to hide internal directories.