Feature Request: Config file support
Currently go-shadowsocks2 uses an ss:// URL as the way to import config, which is simplistic in desktop cases while not in server cases. Config file support enables us to write a universal systemd (or equivalents on other platforms) service that is good for distribution.
It's trivial to load config from an environment file in systemd
file /path/to/go-shadowsocks.env
REMOTE_ADDR=ss://aes-128-gcm:password@host:port
file /etc/systemd/system/go-shadowsocks.service
[Unit]
Description=Shadowsocks2
Wants=network-online.target
After=network-online.target
[Service]
User=nobody
PermissionsStartOnly=true
EnvironmentFile=/path/to/go-shadowsocks2.env
ExecStart=/path/to/go-shadowsocks2 -s $REMOTE_ADDR
Nice=-10
KillMode=process
Restart=on-failure
ProtectSystem=full
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
Thanks, this do solve the problem for status quo.
Yet still I am afraid that the ss:// URL is not optimal as a configuring way for it is not as clear as a ini/json. Also, I believe ss:// is universal, and there would be no place for implementation-specific configuration.
Anyway, closed for now.
This URL config syntax is being discussed in SIP002 https://github.com/shadowsocks/shadowsocks-org/issues/27
Password on the command line is insecure, it can be grabbed by any user account from ps output. Please consider adding file configuration for it (or I can write a PR for it if that's acceptable)
Reopen for reconsideration.
Currently I want to migrate from python shadowsocks to golang one, so I'd prefer using the config I already have:
{
"server": "example.com",
"server_port": "1337",
"local_port": "2285",
"password": "pwd",
"timeout": 600,
"method": "aes-256-cfb"
}
Config shouldn't be necessarily in JSON, but it is very much needed for quick setup on multiple desktops.