From: qydysky Date: Sat, 24 Aug 2024 02:26:25 +0000 (+0800) Subject: 1 X-Git-Tag: v0.28.20240824023126 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=05307322bfb76eccfed8b7ba726ea773e041c2ef;p=part%2F.git 1 --- diff --git a/web/Web.go b/web/Web.go index 2955aed..439d01a 100644 --- a/web/Web.go +++ b/web/Web.go @@ -383,7 +383,8 @@ func (t *Limits) AddCount(r *http.Request) (isOverflow bool) { if len(t.g) == 0 { return } - ip := net.ParseIP(strings.Split(r.RemoteAddr, ":")[0]) + host, _, _ := net.SplitHostPort(r.RemoteAddr) + ip := net.ParseIP(host) var matchs []int for i := 0; !isOverflow && i < len(t.g); i++ {