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

[Feature proposal] Server disable in Extended multiple server configuration #394

Closed
spyophobia opened this issue Jan 24, 2021 · 12 comments
Closed

Comments

@spyophobia
Copy link
Contributor

spyophobia commented Jan 24, 2021

Rationale

shadowsocks-rust supports creating and/or connecting to multiple servers within one configuration file, which is great.

However, sometimes there arises the need, whether during testing or deployment, for us to temporarily disable one or more servers. Example scenarios include:

  • Several conflicting server profiles during testing
  • Isolating the issue during network diagnosis
  • Server temporarily unavailable

Ideally, the user should be able to simply block-comment out a profile to disable it. Unfortunately, JSON format does not have support for comments, which means the user would need to:

  1. either joggle several configuration files
  2. or copying & pasting the profile around in the JSON file

... Neither of which is convenient.

What I am envisioning

Wouldn't it be nice, if you can simply add "disable": true to a server profile and turn it off?

Something like this:

{
    "servers": [
        {
            "address": "127.0.0.1",
            "port": 1080,
            "password": "hello-world",
            "method": "aes-256-gcm",
            "timeout": 300
        },
        {
            "disable": true,
            "address": "127.0.0.1",
            "port": 1081,
            "password": "hello-kitty",
            "method": "chacha20-ietf-poly1305"
        }
    ],
    "local_port": 8388,
    "local_address": "127.0.0.1"
}

I think it would be a good "quality of life" improvement while being not too complicated to implement.

@spyophobia
Copy link
Contributor Author

Also, I personally know some Rust so I'm happy to contribute via a PR.

@database64128
Copy link
Contributor

+1. The feature would be helpful for me as well.

@zgzh
Copy link

zgzh commented Jan 24, 2021

If possible, set the specified server as the default, and use other servers when it fails. This scenario is that the network speed is fast, but the speed is low, so it can’t be optimized. You can only delete the server.

@spyophobia
Copy link
Contributor Author

If possible, set the specified server as the default, and use other servers when it fails. This scenario is that the network speed is fast, but the speed is low, so it can’t be optimized. You can only delete the server.

Don't worry I got you covered. I actually intend to submit another feature proposal about customisation options for the load balancer, which will be a superset of the feature you are describing.

@spyophobia
Copy link
Contributor Author

@zgzh See #395

@zonyitoo
Copy link
Collaborator

Ideally, the user should be able to simply block-comment out a profile to disable it. Unfortunately, JSON format does not have support for comments,

I am using json5 in this project. :P . So yeah, you can use comments.

BTW, I personally agree with the optional disable field. Feel free to open a PR for this. Should it be included in SIP008? @database64128

@spyophobia
Copy link
Contributor Author

I am using json5 in this project. :P . So yeah, you can use comments.

Ahah, tricky. So technically the object keys don't have to be quoted, and arrays can have trailing commas too?

@zonyitoo
Copy link
Collaborator

Technically, yeah. But that is not a standard basic format of shadowsocks, so I am not guranteed that it will not be changed in the future.

zonyitoo pushed a commit that referenced this issue Jan 27, 2021
* Lazy server disable implementation
See #394

* Don't use filter & collect

* Updated README

* Example in Configuration section
@zonyitoo
Copy link
Collaborator

Merged.

@dev4u
Copy link

dev4u commented Jan 27, 2021

可以设置1、0来代表true、false吗?

@zonyitoo
Copy link
Collaborator

Why.

@dev4u
Copy link

dev4u commented Jan 27, 2021

Why.

因为有些三方库,如果设置一个属性为true,他会用1来表示,反之亦然。

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

5 participants