shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.41k stars 1.15k forks source link

Feature Request: Enable multiuser support through a single port #1365

Open miladrahimi opened 10 months ago

miladrahimi commented 10 months ago

Since Shadowsocks 2022 is a different protocol that many clients don't support, the standard Shadowsocks server should enable multiuser functionality through a single port. While Xray-core already has a similar feature, it's important for the official project to adopt this capability as well.

Xray-core configuration sample that support similar functionality:

{
    "inbounds": [
        {
            "port": 1234,
            "protocol": "shadowsocks",
            "settings": {
                "clients": [
                    {
                        "password": "example_user_1",
                        "method": "aes-128-gcm"
                    },
                    {
                        "password": "example_user_2",
                        "method": "aes-256-gcm"
                    },
                    {
                        "password": "example_user_3",
                        "method": "chacha20-poly1305"
                    }
                ],
                "network": "tcp,udp"
            }
        }
    ],
}
zonyitoo commented 10 months ago

Currently not interested in supporting multi-users for AEAD cipher protocols. Since the AEAD protocol itself doesn’t contain any user informations, so the only way to support multi-user is to “try” decrypt with all configured keys. Quite ugly and inefficient.

TheOrdinaryWow commented 1 day ago

Any update on this plz? @zonyitoo I tried to serve same config like

let request_template = AddRequest {
    server_port: remote_config.server_port,
    password: "0".to_owned(),
    method: Some(remote_config.cipher.to_string()),
    no_delay: None,
    plugin: None,
    plugin_opts: None,
    plugin_mode: None,
    mode: None,
    users: None,
};

then to update users based on request_template, and apply the changes using manager_client.add().

It'll just destroy current process and create a new one, which is neither efficient nor elegant. Any suggestion?

zonyitoo commented 1 day ago

No update at all. Use AEAD-2022 with EIH to support multi-users.