Add native Shadowsocks 2022 support with gRPC hot‑add and config safeguards#1964
Open
4erdenko wants to merge 3 commits intoGozargah:masterfrom
Open
Add native Shadowsocks 2022 support with gRPC hot‑add and config safeguards#19644erdenko wants to merge 3 commits intoGozargah:masterfrom
4erdenko wants to merge 3 commits intoGozargah:masterfrom
Conversation
This commit introduces support for Shadowsocks 2022, including new encryption methods and updates to the configuration files. Changes include the addition of new methods in the Proxies component, updates to the account model, and enhancements to the validation logic for server PSK keys. Localization files have also been updated to reflect these changes, ensuring a consistent user experience across different languages.
- Ensure Xray treats inbound settings correctly by adding a placeholder client if none exist. - Manually construct the wire payload for Shadowsocks 2022 accounts to align with expected format, avoiding dependency on proto stubs.
Prevent multiple Shadowsocks 2022 inbounds to ensure users can only hold a single SS2022 credential. Raise a ValueError if more than one inbound is detected, providing clarity on the configuration issue.
salarsahragard
approved these changes
Jan 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xray.proxy.shadowsocks_2022.Accounttype and payload; remove the non-existent...Usertype.VITE_BASE_API=/api/).Why
proxy is not a UserManagerandfailed to parse user > proto: not found./api/prefix causing 404 on/admin/token; we need reproducible builds.What was done
API/types
ShadowsocksMethods; classic account now rejects 2022 methods.Shadowsocks2022Accountthat sendsTypedMessage(type="xray.proxy.shadowsocks_2022.Account")with a minimal wire-encodedkeyfield, matching Xray-core expectations.Backend models & config
ShadowsocksSettingsauto-generates/validates per-user PSK lengths per method (16/32 bytes).method+server_psk; ensuresclientslist has a bootstrap entry to enable UserManager; validates missing/invalid PSK with clear errors.password = "{server_psk}:{user_psk}"and expose SS2022 methods.Operations
Dashboard
VITE_BASE_API=/api/.How it works (SS2022 path)
method=2022-blake3-...,password=<server_psk>,clientscontains a bootstrap user to activateUserManager.common.protocol.UserwhereaccountisTypedMessage(type="xray.proxy.shadowsocks_2022.Account", value=<key bytes>); gRPCAlterInbound(AddUserOperation)succeeds without core restart.${server_psk}:${user_psk}, method matches inbound./api/core/configreturns 400 with a clear message; service won’t start with an impossible mapping.Migration / Notes
VITE_BASE_API=/api/(see build workflow).{server_psk}:{user_psk}.Known issue: Shadowsocks‑2022 memory leak in Xray-core
Testing
DOCKER_BUILDKIT=0 docker compose build marzban.docker compose up -d marzban.POST /api/admin/token→ 200.POST /api/userwith SS2022 method+user key on inboundShadowsocks 2022 TCP→ 200; links generated; no gRPC errors; Xray stays up.