Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
Limiter manages the automated client connection limits.
func NewLimiter ¶
func NewLimiter() *Limiter
NewLimiter returns a new connection limit handler. The handler is functional, but disabled; it can be enabled via `ApplyConfig`.
func (*Limiter) AddClient ¶
AddClient adds a client to our population if possible. If we can't, throws an error instead. 'force' is used to add already-existing clients (i.e. ones that are already on the network).
func (*Limiter) ApplyConfig ¶
func (cl *Limiter) ApplyConfig(config LimiterConfig) error
ApplyConfig atomically applies a config update to a connection limit handler
func (*Limiter) RemoveClient ¶
RemoveClient removes the given address from our population
type LimiterConfig ¶
type LimiterConfig struct {
Enabled bool
CidrLenIPv4 int `yaml:"cidr-len-ipv4"`
CidrLenIPv6 int `yaml:"cidr-len-ipv6"`
ConnsPerSubnet int `yaml:"connections-per-subnet"`
IPsPerSubnet int `yaml:"ips-per-subnet"` // legacy name for ConnsPerSubnet
Exempted []string
}
LimiterConfig controls the automated connection limits.
type ThrottleDetails ¶
ThrottleDetails holds the connection-throttling details for a subnet/IP.
type Throttler ¶
Throttler manages automated client connection throttling.
func NewThrottler ¶
func NewThrottler() *Throttler
NewThrottler returns a new client connection throttler. The throttler is functional, but disabled; it can be enabled via `ApplyConfig`.
func (*Throttler) AddClient ¶
AddClient introduces a new client connection if possible. If we can't, throws an error instead.
func (*Throttler) ApplyConfig ¶
func (ct *Throttler) ApplyConfig(config ThrottlerConfig) error
ApplyConfig atomically applies a config update to a throttler
func (*Throttler) BanDuration ¶
func (*Throttler) BanMessage ¶
type ThrottlerConfig ¶
type ThrottlerConfig struct {
Enabled bool
CidrLenIPv4 int `yaml:"cidr-len-ipv4"`
CidrLenIPv6 int `yaml:"cidr-len-ipv6"`
ConnectionsPerCidr int `yaml:"max-connections"`
DurationString string `yaml:"duration"`
Duration time.Duration `yaml:"duration-time"`
BanDurationString string `yaml:"ban-duration"`
BanDuration time.Duration
BanMessage string `yaml:"ban-message"`
Exempted []string
}
ThrottlerConfig controls the automated connection throttling.