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