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 18:10:49 +08:00
parent 766b7c6936
commit d7bec4a74f
2 changed files with 5 additions and 6 deletions

View File

@ -539,7 +539,7 @@ const (
type LimitFallback struct {
AfterBytes int64
BytesPerSec float64
BytesPerSec int64
BurstBytesPerSec int64
}

9
tls.go
View File

@ -43,7 +43,6 @@ import (
"errors"
"fmt"
"io"
"math"
"net"
"os"
"runtime"
@ -120,11 +119,11 @@ func (c *RatelimitedConn) Write(b []byte) (int, error) {
return n, err
}
func NewBucketWithRate(bytesPerSec float64, burstBytesPerSec int64) *ratelimit.Bucket {
if burstBytesPerSec < int64(math.Ceil(bytesPerSec)) {
burstBytesPerSec = int64(math.Ceil(bytesPerSec))
func NewBucketWithRate(bytesPerSec int64, burstBytesPerSec int64) *ratelimit.Bucket {
if burstBytesPerSec < bytesPerSec {
burstBytesPerSec = bytesPerSec
}
return ratelimit.NewBucketWithRate(bytesPerSec, burstBytesPerSec)
return ratelimit.NewBucketWithRate(float64(bytesPerSec), burstBytesPerSec)
}
var (