package config import ( "reflect" "time" ) // JSCKServerRateLimits is the server rate limits section's configuration key. const JSCKServerRateLimits string = "rate_limits" // JSCServerRateLimits configures the server's rate limits. Global limits // every request from each client, and API each client's API requests (see // JSCRateLimitRule). IdleTTL is how long a client's limiter is kept after its // last request; 0 or less means limiters are never evicted. type JSCServerRateLimits struct { Global JSCRateLimitRule `cfg:"global"` API JSCRateLimitRule `cfg:"api"` IdleTTL time.Duration `cfg:"idle_ttl" default:"10m"` } // ---------- Section methods (see Section) ---------- // Map implements Section. func (c JSCServerRateLimits) Map() map[string]any { return mapOf(c) } // Flatten implements Section. func (c JSCServerRateLimits) Flatten() map[string]any { return flattenOf(JSCKServerRateLimits, c) } // TypeOf implements Section. func (c JSCServerRateLimits) TypeOf(key string) (reflect.Kind, error) { return typeOf(c, key) } // ValueOf implements Section. func (c JSCServerRateLimits) ValueOf(key string) (any, error) { return valueOf(c, key) } // SetValue implements Section. func (c *JSCServerRateLimits) SetValue(key string, value any) error { return setValue(c, key, value) }