From: qydysky Date: Tue, 23 May 2023 13:45:04 +0000 (+0800) Subject: add X-Git-Tag: v0.27.11 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=ff04a18836ac1fba36d1785967ecade8fdaf1136;p=part%2F.git add --- diff --git a/web/Web.go b/web/Web.go index 0d99c9c..f6d9b97 100644 --- a/web/Web.go +++ b/web/Web.go @@ -172,6 +172,9 @@ func (t *CountLimits) SetMaxCount(cidr string, max int) { } func (t *CountLimits) IsOverflow(r *http.Request) (isOverflow bool) { + if len(t.g) == 0 { + return + } ip := net.ParseIP(strings.Split(r.RemoteAddr, ":")[0]) t.l.RLock() defer t.l.RUnlock() @@ -188,6 +191,9 @@ func (t *CountLimits) IsOverflow(r *http.Request) (isOverflow bool) { } func (t *CountLimits) AddOverflow(r *http.Request) (isOverflow bool) { + if len(t.g) == 0 { + return + } ip := net.ParseIP(strings.Split(r.RemoteAddr, ":")[0]) t.l.Lock() defer t.l.Unlock()