Selaa lähdekoodia

review feedback: rename a key

tags/v2.0.0-rc1
Shivaram Lingamneni 4 vuotta sitten
vanhempi
commit
2d456c2106

+ 3
- 3
irc/connection_limits/limiter.go Näytä tiedosto

@@ -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
 

+ 1
- 1
irc/connection_limits/limiter_test.go Näytä tiedosto

@@ -19,7 +19,7 @@ func easyParseIP(ipstr string) (result net.IP) {
19 19
 
20 20
 var baseConfig = LimiterConfig{
21 21
 	rawLimiterConfig: rawLimiterConfig{
22
-		Limit:         true,
22
+		Count:         true,
23 23
 		MaxConcurrent: 4,
24 24
 
25 25
 		Throttle:     true,

+ 1
- 1
irc/connection_limits/throttler_test.go Näytä tiedosto

@@ -67,7 +67,7 @@ func makeTestThrottler(v4len, v6len int) *Limiter {
67 67
 	maxConnections := 3
68 68
 	config := LimiterConfig{
69 69
 		rawLimiterConfig: rawLimiterConfig{
70
-			Limit:        false,
70
+			Count:        false,
71 71
 			Throttle:     true,
72 72
 			CidrLenIPv4:  v4len,
73 73
 			CidrLenIPv6:  v6len,

+ 2
- 2
oragono.yaml Näytä tiedosto

@@ -146,8 +146,8 @@ server:
146 146
 
147 147
     # IP-based DoS protection
148 148
     ip-limits:
149
-        # whether to enforce limits on the total number of concurrent connections per IP/CIDR
150
-        limit: true
149
+        # whether to limit the total count of concurrent connections per IP/CIDR
150
+        count: true
151 151
         # maximum concurrent connections per IP/CIDR
152 152
         max-concurrent-connections: 16
153 153
 

Loading…
Peruuta
Tallenna