- a source's interval must be greater than 0: a source is turned off with enabled, not with a zero interval, so JSCSourcesSource rejects an interval of 0 or less (its validate is promoted to each source's section); - max_message_size rejects -1: JSCServerWebSocket rejects a max_message_size of -1 (util.ByteSizeNoLimit), as a client could then exhaust the server's memory; - every setting documents what 0 or empty means (zero/none, no limit or a default).
37 lines
973 B
Go
37 lines
973 B
Go
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 limiters. 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 {
|
|
IdleTTL time.Duration `cfg:"idle_ttl" default:"10m"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
func (c JSCServerRateLimits) Map() map[string]any { return mapOf(c) }
|
|
|
|
func (c JSCServerRateLimits) Flatten() map[string]any {
|
|
return flattenOf(JSCKServerRateLimits, c)
|
|
}
|
|
|
|
func (c JSCServerRateLimits) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
func (c JSCServerRateLimits) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
func (c *JSCServerRateLimits) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|