mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-12 17:05:01 +03:00
f1ed1a9b17
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.
28 lines
963 B
Go
28 lines
963 B
Go
package xray
|
|
|
|
import "github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
|
|
|
// Shadowsocks2022KeyBytes is the key size a Shadowsocks-2022 method takes, or 0
|
|
// for any other method, whose password is free-form.
|
|
func Shadowsocks2022KeyBytes(method string) int {
|
|
cipher, err := shadowsocks_2022.GetCipherMethod(method)
|
|
if err != nil {
|
|
return 0
|
|
}
|
|
return cipher.KeySaltLength
|
|
}
|
|
|
|
// ValidShadowsocks2022Key reads key the way the core does: base64, else the raw
|
|
// string, and either way exactly the method's key size.
|
|
func ValidShadowsocks2022Key(method, key string) bool {
|
|
_, err := shadowsocks_2022.ParseKey(key, Shadowsocks2022KeyBytes(method))
|
|
return err == nil
|
|
}
|
|
|
|
// Shadowsocks2022NoMultiUser reports a 2022 method xray-core refuses on an
|
|
// inbound with users: the multi-user identity header is AES-only.
|
|
func Shadowsocks2022NoMultiUser(method string) bool {
|
|
cipher, err := shadowsocks_2022.GetCipherMethod(method)
|
|
return err == nil && cipher.IsChaCha
|
|
}
|