Adapt new shadowsocks library.

1. Modify ss/ssu handler and connector
2. Add users to metadata of ss and ssu handler
This commit is contained in:
RMT
2025-11-05 21:26:24 +08:00
committed by ginuerzh
parent d2cc07d3ac
commit 0c97db3c05
12 changed files with 372 additions and 192 deletions
+11
View File
@@ -4,6 +4,7 @@ import (
"time"
mdata "github.com/go-gost/core/metadata"
"github.com/go-gost/go-shadowsocks2/core"
mdutil "github.com/go-gost/x/metadata/util"
)
@@ -15,6 +16,8 @@ type metadata struct {
key string
readTimeout time.Duration
udpBufferSize int
users []core.UserConfig
}
func (h *ssuHandler) parseMetadata(md mdata.Metadata) (err error) {
@@ -23,5 +26,13 @@ func (h *ssuHandler) parseMetadata(md mdata.Metadata) (err error) {
h.md.readTimeout = mdutil.GetDuration(md, "readTimeout")
h.md.udpBufferSize = mdutil.GetInt(md, "udpBufferSize", "udp.bufferSize")
usersMap := mdutil.GetStringMapString(md, "users")
for name, pass := range usersMap {
h.md.users = append(h.md.users, core.UserConfig{
Name: name,
Password: pass,
})
}
return
}