Просмотр исходного кода

review feedback: rename a key

tags/v2.0.0-rc1
Shivaram Lingamneni 4 лет назад
Родитель
Сommit
2d456c2106

+ 3
- 3
irc/connection_limits/limiter.go Просмотреть файл

33
 // rawLimiterConfig contains all the YAML-visible fields;
33
 // rawLimiterConfig contains all the YAML-visible fields;
34
 // LimiterConfig contains additional denormalized private fields
34
 // LimiterConfig contains additional denormalized private fields
35
 type rawLimiterConfig struct {
35
 type rawLimiterConfig struct {
36
-	Limit         bool
36
+	Count         bool
37
 	MaxConcurrent int `yaml:"max-concurrent-connections"`
37
 	MaxConcurrent int `yaml:"max-concurrent-connections"`
38
 
38
 
39
 	Throttle     bool
39
 	Throttle     bool
156
 	}
156
 	}
157
 
157
 
158
 	// now check limiter
158
 	// now check limiter
159
-	if cl.config.Limit {
159
+	if cl.config.Count {
160
 		count := cl.limiter[addrString] + 1
160
 		count := cl.limiter[addrString] + 1
161
 		if count > maxConcurrent {
161
 		if count > maxConcurrent {
162
 			return ErrLimitExceeded
162
 			return ErrLimitExceeded
172
 	cl.Lock()
172
 	cl.Lock()
173
 	defer cl.Unlock()
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
 		return
176
 		return
177
 	}
177
 	}
178
 
178
 

+ 1
- 1
irc/connection_limits/limiter_test.go Просмотреть файл

19
 
19
 
20
 var baseConfig = LimiterConfig{
20
 var baseConfig = LimiterConfig{
21
 	rawLimiterConfig: rawLimiterConfig{
21
 	rawLimiterConfig: rawLimiterConfig{
22
-		Limit:         true,
22
+		Count:         true,
23
 		MaxConcurrent: 4,
23
 		MaxConcurrent: 4,
24
 
24
 
25
 		Throttle:     true,
25
 		Throttle:     true,

+ 1
- 1
irc/connection_limits/throttler_test.go Просмотреть файл

67
 	maxConnections := 3
67
 	maxConnections := 3
68
 	config := LimiterConfig{
68
 	config := LimiterConfig{
69
 		rawLimiterConfig: rawLimiterConfig{
69
 		rawLimiterConfig: rawLimiterConfig{
70
-			Limit:        false,
70
+			Count:        false,
71
 			Throttle:     true,
71
 			Throttle:     true,
72
 			CidrLenIPv4:  v4len,
72
 			CidrLenIPv4:  v4len,
73
 			CidrLenIPv6:  v6len,
73
 			CidrLenIPv6:  v6len,

+ 2
- 2
oragono.yaml Просмотреть файл

146
 
146
 
147
     # IP-based DoS protection
147
     # IP-based DoS protection
148
     ip-limits:
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
         # maximum concurrent connections per IP/CIDR
151
         # maximum concurrent connections per IP/CIDR
152
         max-concurrent-connections: 16
152
         max-concurrent-connections: 16
153
 
153
 

Загрузка…
Отмена
Сохранить