mirror of
https://github.com/XTLS/REALITY.git
synced 2025-08-22 22:48:36 +00:00
int64
This commit is contained in:
parent
766b7c6936
commit
d7bec4a74f
@ -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
9
tls.go
@ -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 (
|
||||||
|
Loading…
Reference in New Issue
Block a user