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

@ -11,8 +11,8 @@ import (
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
metrics "github.com/go-gost/core/metrics/wrapper"
"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"
)

View File

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