Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Server instances per local port #1095

Open
Kein opened this issue Jan 22, 2023 · 6 comments
Open

[FR] Server instances per local port #1095

Kein opened this issue Jan 22, 2023 · 6 comments

Comments

@Kein
Copy link

Kein commented Jan 22, 2023

So, multiple server is a great addition to shadowsocks, however my issue is that it essentially works as load balancer rather than actual being separate servers. It would be great if we could define for each server a local listener instance with unique local port. For example, Server1-3 declared in the config file gets requests from 127.0.0.1:1080 but Servers 3-5 will be getting requests from 127.0.0.1:1081. This mean sslocal can open multiple listen ports and two or more instances no longer required for this to work.

So essentially:

{
    "servers": [
        {
            "address": ".ip.ip.ip.ip",
            "port": 8388,
            "password": "hello-world",
            "method": "aes-256-gcm",
            "timeout": 7200,
            "local_port": 1081,
            "local_address": "127.0.0.1"
        },
        {
            "address": "ip.ip.ip.ip",
            "port": 8389,
            "password": "hello-kitty",
            "method": "chacha20-ietf-poly1305",
            "local_port": 1082,
            "local_address": "127.0.0.1"
        },
    ],
    #Global listener for all servers who dont have it defined per server
    "local_port": 8888,
    "local_address": "127.0.0.1"
}
@ArchGuyWu
Copy link

ArchGuyWu commented Mar 13, 2023

You can start multiple shadowsocks instances use this:

#[email protected]
[Unit]
Description=Shadowsocks-Rust Server Service
After=network.target
Wants=network-online.target

[Service]
Type=simple
DynamicUser=yes
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/ssservice server --log-without-time -c /etc/shadowsocks-rust/%i.json

[Install]
WantedBy=multi-user.target

@database64128
Copy link
Contributor

I think a comprehensive routing system, like the one in shadowsocks-go, can cover even more use cases, and is much more flexible than the ACL in shadowsocks-rust.

I also don't quite like how the ACL code integrates with the rest of shadowsocks-rust. It seems overly complex with layers of abstractions and is such a special case. But I don't know, maybe I'm just new to Rust and this is how they do things in Rust.

@Kein
Copy link
Author

Kein commented Mar 13, 2023

You can start multiple shadowsocks instances use this:

Yes, I know, which is precisely the reason this request exist, because it is not very handy. Though if this is out of scope of the fork/port then I suppose it can be closed.

Also, my bad, when I said "server instances" I meant on client listener side, i.e. one client - multiple local listen/accept ports each tied to its own server or even group of servers

@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 27, 2023

It would be great if we could define for each server a local listener instance with unique local port.

Emm, it is quite easy to implement.

Ahh.. I was wrong. I through you want a unique outbound_bind_addr for each servers. But this is not what you want.

@Kein
Copy link
Author

Kein commented Aug 27, 2023

Yeah, basically I want one client instance being able to route and work with multiple different servers via port-recognition. This way you dont have to run multiple client instances.

@zonyitoo
Copy link
Collaborator

Well, you will need a v2ray-like router logic. That is quite a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants