add pkgs from core

This commit is contained in:
ginuerzh
2022-04-04 12:44:35 +08:00
parent 7eb3687e0e
commit a3346ad246
188 changed files with 6084 additions and 283 deletions

View File

@ -10,8 +10,8 @@ import (
"github.com/go-gost/core/dialer"
md "github.com/go-gost/core/metadata"
"github.com/go-gost/core/registry"
ws_util "github.com/go-gost/x/internal/util/ws"
"github.com/go-gost/x/registry"
"github.com/gorilla/websocket"
"github.com/xtaci/smux"
)

View File

@ -5,6 +5,7 @@ import (
"time"
mdata "github.com/go-gost/core/metadata"
mdx "github.com/go-gost/x/metadata"
)
const (
@ -54,34 +55,34 @@ func (d *mwsDialer) parseMetadata(md mdata.Metadata) (err error) {
muxMaxStreamBuffer = "muxMaxStreamBuffer"
)
d.md.host = mdata.GetString(md, host)
d.md.host = mdx.GetString(md, host)
d.md.path = mdata.GetString(md, path)
d.md.path = mdx.GetString(md, path)
if d.md.path == "" {
d.md.path = defaultPath
}
d.md.muxKeepAliveDisabled = mdata.GetBool(md, muxKeepAliveDisabled)
d.md.muxKeepAliveInterval = mdata.GetDuration(md, muxKeepAliveInterval)
d.md.muxKeepAliveTimeout = mdata.GetDuration(md, muxKeepAliveTimeout)
d.md.muxMaxFrameSize = mdata.GetInt(md, muxMaxFrameSize)
d.md.muxMaxReceiveBuffer = mdata.GetInt(md, muxMaxReceiveBuffer)
d.md.muxMaxStreamBuffer = mdata.GetInt(md, muxMaxStreamBuffer)
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.handshakeTimeout = mdata.GetDuration(md, handshakeTimeout)
d.md.readHeaderTimeout = mdata.GetDuration(md, readHeaderTimeout)
d.md.readBufferSize = mdata.GetInt(md, readBufferSize)
d.md.writeBufferSize = mdata.GetInt(md, writeBufferSize)
d.md.enableCompression = mdata.GetBool(md, enableCompression)
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)
if m := mdata.GetStringMapString(md, header); len(m) > 0 {
if m := mdx.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 = mdata.GetDuration(md, keepAlive)
d.md.keepAlive = mdx.GetDuration(md, keepAlive)
return
}