mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
parent
eef9753912
commit
fd45529d94
3 changed files with 54 additions and 1 deletions
13
irc/uban.go
13
irc/uban.go
|
|
@ -366,7 +366,14 @@ func ubanInfoHandler(client *Client, target ubanTarget, params []string, rb *Res
|
|||
}
|
||||
|
||||
func ubanInfoCIDR(client *Client, target ubanTarget, rb *ResponseBuffer) {
|
||||
if target.cidr.PrefixLen == 128 {
|
||||
config := client.server.Config()
|
||||
// show connection limiter/throttler state if this CIDR is entirely
|
||||
// contained in a single limiter/throttler bucket:
|
||||
ones, bits := target.cidr.Size()
|
||||
showLimiter := (bits == 32 && ones >= config.Server.IPLimits.CidrLenIPv4) ||
|
||||
(bits == 128 && ones >= config.Server.IPLimits.CidrLenIPv6)
|
||||
sendMaskWarning := (bits == 128 && ones > config.Server.IPLimits.CidrLenIPv6)
|
||||
if showLimiter {
|
||||
netName, status := client.server.connectionLimiter.Status(target.cidr.IP)
|
||||
if status.Exempt {
|
||||
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) {
|
|||
rb.Notice(line)
|
||||
}
|
||||
}
|
||||
if sendMaskWarning {
|
||||
rb.Notice(fmt.Sprintf(client.t("Note: try evaluating a wider IPv6 CIDR like %s/%d"),
|
||||
target.cidr.IP.String(), config.Server.IPLimits.CidrLenIPv6))
|
||||
}
|
||||
}
|
||||
|
||||
func ubanInfoNickmask(client *Client, target ubanTarget, rb *ResponseBuffer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue