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 (
@ -40,23 +40,23 @@ func (l *wsListener) parseMetadata(md mdata.Metadata) (err error) {
header = "header"
)
l.md.path = mdx.GetString(md, path)
l.md.path = mdutil.GetString(md, path)
if l.md.path == "" {
l.md.path = defaultPath
}
l.md.backlog = mdx.GetInt(md, backlog)
l.md.backlog = mdutil.GetInt(md, backlog)
if l.md.backlog <= 0 {
l.md.backlog = defaultBacklog
}
l.md.handshakeTimeout = mdx.GetDuration(md, handshakeTimeout)
l.md.readHeaderTimeout = mdx.GetDuration(md, readHeaderTimeout)
l.md.readBufferSize = mdx.GetInt(md, readBufferSize)
l.md.writeBufferSize = mdx.GetInt(md, writeBufferSize)
l.md.enableCompression = mdx.GetBool(md, enableCompression)
l.md.handshakeTimeout = mdutil.GetDuration(md, handshakeTimeout)
l.md.readHeaderTimeout = mdutil.GetDuration(md, readHeaderTimeout)
l.md.readBufferSize = mdutil.GetInt(md, readBufferSize)
l.md.writeBufferSize = mdutil.GetInt(md, writeBufferSize)
l.md.enableCompression = mdutil.GetBool(md, enableCompression)
if mm := mdx.GetStringMapString(md, header); len(mm) > 0 {
if mm := mdutil.GetStringMapString(md, header); len(mm) > 0 {
hd := http.Header{}
for k, v := range mm {
hd.Add(k, v)