add backup filter

This commit is contained in:
ginuerzh
2022-09-02 11:52:44 +08:00
parent 9b695bc374
commit 09dbdbb03c
61 changed files with 289 additions and 408 deletions

View File

@ -5,7 +5,7 @@ import (
"time"
mdata "github.com/go-gost/core/metadata"
mdx "github.com/go-gost/x/metadata"
mdutil "github.com/go-gost/core/metadata/util"
)
const (
@ -55,34 +55,34 @@ func (d *mwsDialer) parseMetadata(md mdata.Metadata) (err error) {
muxMaxStreamBuffer = "muxMaxStreamBuffer"
)
d.md.host = mdx.GetString(md, host)
d.md.host = mdutil.GetString(md, host)
d.md.path = mdx.GetString(md, path)
d.md.path = mdutil.GetString(md, path)
if d.md.path == "" {
d.md.path = defaultPath
}
d.md.muxKeepAliveDisabled = mdx.GetBool(md, muxKeepAliveDisabled)
d.md.muxKeepAliveInterval = mdx.GetDuration(md, muxKeepAliveInterval)
d.md.muxKeepAliveTimeout = mdx.GetDuration(md, muxKeepAliveTimeout)
d.md.muxMaxFrameSize = mdx.GetInt(md, muxMaxFrameSize)
d.md.muxMaxReceiveBuffer = mdx.GetInt(md, muxMaxReceiveBuffer)
d.md.muxMaxStreamBuffer = mdx.GetInt(md, muxMaxStreamBuffer)
d.md.muxKeepAliveDisabled = mdutil.GetBool(md, muxKeepAliveDisabled)
d.md.muxKeepAliveInterval = mdutil.GetDuration(md, muxKeepAliveInterval)
d.md.muxKeepAliveTimeout = mdutil.GetDuration(md, muxKeepAliveTimeout)
d.md.muxMaxFrameSize = mdutil.GetInt(md, muxMaxFrameSize)
d.md.muxMaxReceiveBuffer = mdutil.GetInt(md, muxMaxReceiveBuffer)
d.md.muxMaxStreamBuffer = mdutil.GetInt(md, muxMaxStreamBuffer)
d.md.handshakeTimeout = mdx.GetDuration(md, handshakeTimeout)
d.md.readHeaderTimeout = mdx.GetDuration(md, readHeaderTimeout)
d.md.readBufferSize = mdx.GetInt(md, readBufferSize)
d.md.writeBufferSize = mdx.GetInt(md, writeBufferSize)
d.md.enableCompression = mdx.GetBool(md, enableCompression)
d.md.handshakeTimeout = mdutil.GetDuration(md, handshakeTimeout)
d.md.readHeaderTimeout = mdutil.GetDuration(md, readHeaderTimeout)
d.md.readBufferSize = mdutil.GetInt(md, readBufferSize)
d.md.writeBufferSize = mdutil.GetInt(md, writeBufferSize)
d.md.enableCompression = mdutil.GetBool(md, enableCompression)
if m := mdx.GetStringMapString(md, header); len(m) > 0 {
if m := mdutil.GetStringMapString(md, header); len(m) > 0 {
h := http.Header{}
for k, v := range m {
h.Add(k, v)
}
d.md.header = h
}
d.md.keepAlive = mdx.GetDuration(md, keepAlive)
d.md.keepAlive = mdutil.GetDuration(md, keepAlive)
return
}