From 96d26a542604b38c2a00631e5a9aa8ff1d6a73a1 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Wed, 15 Apr 2026 02:28:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E5=A4=A7=E5=93=A5=E8=B5=90=E5=AE=83?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1=E6=B5=8B=E8=AF=95=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/xboard/service.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/service/xboard/service.go b/service/xboard/service.go index c0c6cad7..7eb392ed 100644 --- a/service/xboard/service.go +++ b/service/xboard/service.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "math/rand" "net/http" "net/netip" "net/url" @@ -621,13 +622,26 @@ func (s *Service) setupNode() error { ssOptions := &option.ShadowsocksInboundOptions{ ListenOptions: listen, Method: method, - Managed: true, } - if strings.Contains(method, "2022") { - // SS2022: server_key is ALREADY Base64 from panel (Double-wrapping fixed) + isSS2022 := strings.Contains(method, "2022") + var dummyKey string + if isSS2022 { ssOptions.Password = serverKey + dummyBytes := make([]byte, ss2022KeyLength(method)) + for i := range dummyBytes { + dummyBytes[i] = byte(rand.Intn(256)) + } + dummyKey = base64.StdEncoding.EncodeToString(dummyBytes) + } else { + dummyKey = "dummy_user_key" + } + ssOptions.Users = []option.ShadowsocksUser{{ + Password: dummyKey, + }} + + if isSS2022 { s.logger.Info("Xboard SS2022 setup. Method: ", method, " Master_PSK: ", ssOptions.Password) } else { // Legacy SS: password-based