]> 127.0.0.1 Git - part/.git/commitdiff
1 v0.28.20240824023126
authorqydysky <qydysky@foxmail.com>
Sat, 24 Aug 2024 02:26:25 +0000 (10:26 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 24 Aug 2024 02:26:25 +0000 (10:26 +0800)
web/Web.go

index 2955aed4a916a6f58a571b077339e675e6b612d9..439d01a5b86e176c4fcde6d1e3c0eefe3be286a9 100644 (file)
@@ -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++ {