fix traffic limiter for CIDR

This commit is contained in:
ginuerzh
2022-11-05 16:10:26 +08:00
parent 2b9ea187b8
commit 84079e32d2
3 changed files with 59 additions and 41 deletions

View File

@ -238,7 +238,7 @@ func (l *connLimiter) reload(ctx context.Context) error {
ipLimits[key] = NewConnLimitGenerator(limit)
default:
if ip := net.ParseIP(key); ip != nil {
ipLimits[key] = NewConnLimitGenerator(limit)
ipLimits[key] = NewConnLimitSingleGenerator(limit)
break
}
if _, ipNet, _ := net.ParseCIDR(key); ipNet != nil {