fix(inbounds): refuse 2022-blake3-chacha20-poly1305 on shadowsocks inbounds

xray-core builds a Shadowsocks-2022 inbound with users only for the AES
methods: the multi-user identity header is AES-only, so the config
builder and the multi-user server both reject chacha20. Every panel
inbound carries clients, so picking 2022-blake3-chacha20-poly1305 in the
inbound form kept the whole core from starting; its links also failed
on the client with "multi-key is not supported".

The inbound form no longer offers the method and AddInbound/UpdateInbound
reject it. Startup moves stored inbounds to 2022-blake3-aes-256-gcm,
which takes the same 32-byte keys, so every stored key stays valid.
Outbounds keep the method, since a single-key outbound to such a server
works. The share-link generator drops the single-user branch that only
this method reached.
This commit is contained in:
MHSanaei
2026-10-11 21:20:07 +02:00
parent b9e1d3afee
commit f1ed1a9b17
16 changed files with 203 additions and 45 deletions
+6 -3
View File
@@ -509,9 +509,9 @@ func shadowsocksKeyBytes(method string) int {
return 0
}
// validateShadowsocks2022ServerKey refuses a server key xray-core cannot parse:
// the core then fails to build the inbound and does not start at all.
func validateShadowsocks2022ServerKey(protocol model.Protocol, settings string) error {
// validateShadowsocks2022Inbound refuses a method or server key xray-core cannot
// build an inbound from: the core then does not start at all.
func validateShadowsocks2022Inbound(protocol model.Protocol, settings string) error {
if protocol != model.Shadowsocks {
return nil
}
@@ -526,6 +526,9 @@ func validateShadowsocks2022ServerKey(protocol model.Protocol, settings string)
if n == 0 {
return nil
}
if xray.Shadowsocks2022NoMultiUser(parsed.Method) {
return common.NewErrorf("shadowsocks inbound method %s does not support multiple users, use a 2022-blake3-aes method", parsed.Method)
}
if !xray.ValidShadowsocks2022Key(parsed.Method, parsed.Password) {
return common.NewErrorf("shadowsocks inbound password: %s needs a %d-byte key, base64 encoded", parsed.Method, n)
}