add traffic limiter for relay bind
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"crypto"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/go-gost/core/bypass"
|
||||
@@ -15,12 +14,11 @@ import (
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
readTimeout time.Duration
|
||||
enableBind bool
|
||||
udpBufferSize int
|
||||
noDelay bool
|
||||
hash string
|
||||
muxCfg *mux.Config
|
||||
readTimeout time.Duration
|
||||
enableBind bool
|
||||
noDelay bool
|
||||
hash string
|
||||
muxCfg *mux.Config
|
||||
|
||||
observerPeriod time.Duration
|
||||
observerResetTraffic bool
|
||||
@@ -47,13 +45,6 @@ func (h *relayHandler) parseMetadata(md mdata.Metadata) (err error) {
|
||||
|
||||
h.md.enableBind = mdutil.GetBool(md, "bind")
|
||||
h.md.noDelay = mdutil.GetBool(md, "nodelay")
|
||||
|
||||
if bs := mdutil.GetInt(md, "udpBufferSize"); bs > 0 {
|
||||
h.md.udpBufferSize = int(math.Min(math.Max(float64(bs), 512), 64*1024))
|
||||
} else {
|
||||
h.md.udpBufferSize = 4096
|
||||
}
|
||||
|
||||
h.md.hash = mdutil.GetString(md, "hash")
|
||||
|
||||
h.md.muxCfg = &mux.Config{
|
||||
|
||||
Reference in New Issue
Block a user