-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Client][Enhancement] Better support for servers with backup ports #706
Comments
Still interested in this. Serversocks isn't by default a "chatty" protocol, so it feels like the current |
If I understand it correctly, you want servers in local should be grouped by IPs? |
That's my original issue, though perhaps the best solution would be to provide a different mode of choosing which server to use. For example, choosing to use the first configured server unless there is a failure. On failure, switch to second configured server, and so on. |
What you are proposing is to make a passive balancer, which servers' weights are reported by each connections. |
There may be a solution that:
But currently we couldn't know when we saw a connect failure whether it cannot connect to the shadowsocks-server or cannot connect to remote target. shadowsocks-rust/crates/shadowsocks-service/src/local/socks/server/socks5/tcprelay.rs Lines 159 to 171 in 93f0fb7
|
Yes, a passive balancer. That's a great way to describe it. I agree with your Hmm, I see the problem you're mentioning. Right now, it seems like there's no way to pass the result of I guess that is the key to my issue. Could we update the way I'm not an expert at Rust, but as I look at the code, I think the I noticed the failure to connect is actually not displayed in any trace or debug message either. For example, with my internet connection turned off:
Perhaps the failure to connect should be logged, too. That's a separate issue, though. |
Since enum Balancer {
Ping(PingBalancer),
PassiveWeight(PassiveWeightBalancer),
} providing unified APIs to other modules. For servers that enabled TFO, the |
Yes, I think that sounds right.
Good point. Sounds like we need a way to report both |
On the other hand, how about UDP associations? There is no way to "passively" detect whether the server is still there without actively UDP detection. |
Hmm, you are right. While many UDP datagrams may expect responses of some sort eventually, we can't count on that. I'm not against a "Passive" balancer that actually still needs to perform its own connectivity checks in some situations. "Quiet" balancer could be another name for it. My main goal in this issue is reducing the chances that shadowsocks-rust clients expose themselves because of identifiable behavior, or expose any/all their configured servers, if the client is discovered. The way I'm hoping to arrive at this goal is to make a new balancer which decreases the behaviors of For UDP, I'm thinking the best we could do is send minimal amounts of and/or minimally noticeable One potential way this could work:
Honestly, we could handle TCP similarly, too. It's not perfect, but it's much quieter than
In this case, we'd always check against a reliably-up service, so any connect failures would clearly be from the connection to the shadowsocks-server. What do you think? Do you think this approach is better than a purely passive one for TCP? |
So what you are proposing is that to make a balancer that only "ping" one of the servers until it has connection errors? |
It would "ping" only the active server, and only when the client is trying to send data. I'm open to other ideas as well. |
Thank you for those commits. To achieve what I'm asking for, it sounds like what I'll have to do is set a very long |
Yes. |
Excellent. The only difference between that and what I suggested is that this will still run the I was hoping to change the interval during use: While That said, I'm very grateful for your work on this, and I'm happy with this solution for now. You've done more than I could have expected, and I appreciate it. |
Great. Then I would closing this issue now. |
Sounds good. Thanks again. |
As per the latest blocking mitigation advice from GFW Report, many server owners, myself included, may have changed their configurations to support multiple ports as a backup.
After configuring
sslocal
to know about each of these "servers" (in reality the same machine on different ports), by defaultsslocal
will send a connectivity check through each configured server every ~10 seconds.In this scenario, the connectivity checks are unnecessary (because it's the same server machine, so latency won't differ and load balancing is not needed). It's also potentially fingerprintable behavior.
If we agree this is something to fix, we could (just one potential solution of many) modify
PingBalancer
'schecker_task
method:shadowsocks-rust/crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs
Lines 332 to 340 in a77ea0b
It could include a third option such as
checker_task_fallback_only
, or we could just modifycheck_once
.My suggested fix doesn't actually remove the connectivity checks altogether (which I think would be much better -- and just fall back to another port on connection failure), but this is how I could see to do this without too much heavy lifting.
Perhaps the "best" fix would involve making a new way to configure this (same server, multiple ports) in the config file, then adding fallback functionality for the client outside of the
loadbalancing
module, but that's over my head in terms of my familiarity with this project.The text was updated successfully, but these errors were encountered: