|
@@ -33,7 +33,7 @@ type customLimit struct {
|
33
|
33
|
// rawLimiterConfig contains all the YAML-visible fields;
|
34
|
34
|
// LimiterConfig contains additional denormalized private fields
|
35
|
35
|
type rawLimiterConfig struct {
|
36
|
|
- Limit bool
|
|
36
|
+ Count bool
|
37
|
37
|
MaxConcurrent int `yaml:"max-concurrent-connections"`
|
38
|
38
|
|
39
|
39
|
Throttle bool
|
|
@@ -156,7 +156,7 @@ func (cl *Limiter) AddClient(addr net.IP) error {
|
156
|
156
|
}
|
157
|
157
|
|
158
|
158
|
// now check limiter
|
159
|
|
- if cl.config.Limit {
|
|
159
|
+ if cl.config.Count {
|
160
|
160
|
count := cl.limiter[addrString] + 1
|
161
|
161
|
if count > maxConcurrent {
|
162
|
162
|
return ErrLimitExceeded
|
|
@@ -172,7 +172,7 @@ func (cl *Limiter) RemoveClient(addr net.IP) {
|
172
|
172
|
cl.Lock()
|
173
|
173
|
defer cl.Unlock()
|
174
|
174
|
|
175
|
|
- if !cl.config.Limit || utils.IPInNets(addr, cl.config.exemptedNets) {
|
|
175
|
+ if !cl.config.Count || utils.IPInNets(addr, cl.config.exemptedNets) {
|
176
|
176
|
return
|
177
|
177
|
}
|
178
|
178
|
|