fix race condition

This commit is contained in:
ginuerzh
2023-10-19 23:47:47 +08:00
parent f2fd6554ad
commit cc4310106b
29 changed files with 157 additions and 156 deletions

View File

@ -6,6 +6,7 @@ import (
mdata "github.com/go-gost/core/metadata"
mdutil "github.com/go-gost/core/metadata/util"
"github.com/go-gost/x/internal/util/mux"
)
type metadata struct {
@ -16,6 +17,7 @@ type metadata struct {
udpBufferSize int
compatibilityMode bool
hash string
muxCfg *mux.Config
}
func (h *socks5Handler) parseMetadata(md mdata.Metadata) (err error) {
@ -43,5 +45,15 @@ func (h *socks5Handler) parseMetadata(md mdata.Metadata) (err error) {
h.md.compatibilityMode = mdutil.GetBool(md, compatibilityMode)
h.md.hash = mdutil.GetString(md, hash)
h.md.muxCfg = &mux.Config{
Version: mdutil.GetInt(md, "mux.version"),
KeepAliveInterval: mdutil.GetDuration(md, "mux.keepaliveInterval"),
KeepAliveDisabled: mdutil.GetBool(md, "mux.keepaliveDisabled"),
KeepAliveTimeout: mdutil.GetDuration(md, "mux.keepaliveTimeout"),
MaxFrameSize: mdutil.GetInt(md, "mux.maxFrameSize"),
MaxReceiveBuffer: mdutil.GetInt(md, "mux.maxReceiveBuffer"),
MaxStreamBuffer: mdutil.GetInt(md, "mux.maxStreamBuffer"),
}
return nil
}