0
0
mirror of https://github.com/XTLS/REALITY.git synced 2025-08-22 14:38:35 +00:00
This commit is contained in:
Meo597 2025-06-08 19:44:26 +08:00
parent b1225047c7
commit fad0d8da96

4
tls.go
View File

@ -119,7 +119,7 @@ func (c *RatelimitedConn) Read(b []byte) (int, error) {
return n, err return n, err
} }
func NewRatelimitedConn(con net.Conn, limit *LimitFallback) *RatelimitedConn { func NewRatelimitedConn(conn net.Conn, limit *LimitFallback) net.Conn {
bytesPerSec := limit.BytesPerSec bytesPerSec := limit.BytesPerSec
burstBytesPerSec := limit.BurstBytesPerSec burstBytesPerSec := limit.BurstBytesPerSec
afterBytes := limit.AfterBytes afterBytes := limit.AfterBytes
@ -129,7 +129,7 @@ func NewRatelimitedConn(con net.Conn, limit *LimitFallback) *RatelimitedConn {
} }
return &RatelimitedConn{ return &RatelimitedConn{
Conn: con, Conn: conn,
Bucket: ratelimit.NewBucketWithRate(float64(bytesPerSec), int64(burstBytesPerSec)), Bucket: ratelimit.NewBucketWithRate(float64(bytesPerSec), int64(burstBytesPerSec)),
LimitAfter: int64(afterBytes), LimitAfter: int64(afterBytes),
} }