0
0
mirror of https://github.com/XTLS/REALITY.git synced 2025-08-22 22:48:36 +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 { type LimitFallback struct {
AfterBytes int64 AfterBytes int64
BytesPerSec float64 BytesPerSec int64
BurstBytesPerSec int64 BurstBytesPerSec int64
} }

9
tls.go
View File

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