|
@@ -366,7 +366,14 @@ func ubanInfoHandler(client *Client, target ubanTarget, params []string, rb *Res
|
366
|
366
|
}
|
367
|
367
|
|
368
|
368
|
func ubanInfoCIDR(client *Client, target ubanTarget, rb *ResponseBuffer) {
|
369
|
|
- if target.cidr.PrefixLen == 128 {
|
|
369
|
+ config := client.server.Config()
|
|
370
|
+ // show connection limiter/throttler state if this CIDR is entirely
|
|
371
|
+ // contained in a single limiter/throttler bucket:
|
|
372
|
+ ones, bits := target.cidr.Size()
|
|
373
|
+ showLimiter := (bits == 32 && ones >= config.Server.IPLimits.CidrLenIPv4) ||
|
|
374
|
+ (bits == 128 && ones >= config.Server.IPLimits.CidrLenIPv6)
|
|
375
|
+ sendMaskWarning := (bits == 128 && ones > config.Server.IPLimits.CidrLenIPv6)
|
|
376
|
+ if showLimiter {
|
370
|
377
|
netName, status := client.server.connectionLimiter.Status(target.cidr.IP)
|
371
|
378
|
if status.Exempt {
|
372
|
379
|
rb.Notice(fmt.Sprintf(client.t("IP %s is exempt from connection limits"), target.cidr.IP.String()))
|
|
@@ -391,6 +398,10 @@ func ubanInfoCIDR(client *Client, target ubanTarget, rb *ResponseBuffer) {
|
391
|
398
|
rb.Notice(line)
|
392
|
399
|
}
|
393
|
400
|
}
|
|
401
|
+ if sendMaskWarning {
|
|
402
|
+ rb.Notice(fmt.Sprintf(client.t("Note: try evaluating a wider IPv6 CIDR like %s/%d"),
|
|
403
|
+ target.cidr.IP.String(), config.Server.IPLimits.CidrLenIPv6))
|
|
404
|
+ }
|
394
|
405
|
}
|
395
|
406
|
|
396
|
407
|
func ubanInfoNickmask(client *Client, target ubanTarget, rb *ResponseBuffer) {
|