From ec76429d50e52f2dec09b967cb546f24dfef8106 Mon Sep 17 00:00:00 2001 From: "qcqcqc@wsl" Date: Fri, 9 Jan 2026 17:14:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20limit=E4=B8=8D=E4=B8=BA0=E6=89=8D?= =?UTF-8?q?=E5=81=9A=E9=99=90=E5=88=B6=EF=BC=8C=E5=90=A6=E5=88=99=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/forwarder/forwarder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/forwarder/forwarder.go b/src/server/forwarder/forwarder.go index e1d37f5..55742f4 100644 --- a/src/server/forwarder/forwarder.go +++ b/src/server/forwarder/forwarder.go @@ -165,7 +165,7 @@ func (f *Forwarder) checkIPAllowed(remoteAddr string) bool { func NewForwarder(sourcePort int, targetHost string, targetPort int, limit *int64, accessRule *string, accessIPs *string) *Forwarder { ctx, cancel := context.WithCancel(context.Background()) var limiterOut, limiterIn *rate.Limiter - if limit != nil { + if limit != nil && *limit != 0 { // burst设置为1秒的流量,这样可以平滑处理突发 // 同时不会一次性消耗太多令牌 burst := int(*limit) / 100 @@ -203,7 +203,7 @@ func NewForwarder(sourcePort int, targetHost string, targetPort int, limit *int6 func NewTunnelForwarder(sourcePort int, targetHost string, targetPort int, tunnelServer TunnelServer, limit *int64, accessRule *string, accessIPs *string) *Forwarder { ctx, cancel := context.WithCancel(context.Background()) var limiterOut, limiterIn *rate.Limiter - if limit != nil { + if limit != nil && *limit != 0 { // burst设置为1秒的流量,这样可以平滑处理突发 // 同时不会一次性消耗太多令牌 burst := int(*limit) / 100