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

Add an option to let user wrap SIP003 environment variables as normal in-line arguments #1672

Closed
celeron533 opened this issue Feb 10, 2018 · 1 comment

Comments

@celeron533
Copy link
Contributor

Just a brainstorm

According to shadowsocks/shadowsocks-org#28 , the SIP003 arguments are delivered by environment variables:
Mandatory:
SS_REMOTE_HOST, SS_REMOTE_PORT, SS_LOCAL_HOST and SS_LOCAL_PORT
Optional:
SS_PLUGIN_OPTIONS


Currently, a SIP003 "compatible" plugin program must able to read and grab its Process environment variables when being launched. Equivalent to the following console commands:

  1. ss-win set the environment variables
set SS_REMOTE_HOST=1.2.3.4
set SS_REMOTE_PORT=9999
set SS_LOCAL_HOST=127.0.0.2
set SS_LOCAL_PORT=33333
set SS_PLUGIN_OPTIONS=foobar
  1. Then ss-win launch the plugin
start someplugin.exe

If user has plugins whose implementation does not following SIP003 standard, user should have a work-around to give the in-line arguments when starting the plugin program. For instance:

  1. ss-win set the environment variables
set SS_REMOTE_HOST=1.2.3.4
set SS_REMOTE_PORT=9999
set SS_LOCAL_HOST=127.0.0.2
set SS_LOCAL_PORT=33333
set SS_PLUGIN_OPTIONS=foobar
  1. User typed the format and pattern for the in-line arguments wrapper
-remote %SS_REMOTE_HOST%:%SS_REMOTE_PORT% -local %SS_LOCAL_HOST%:%SS_LOCAL_PORT% %SS_PLUGIN_OPTIONS%
  1. Then ss-win launch the plugin by using the wrapper
start someplugin.exe -remote %SS_REMOTE_HOST%:%SS_REMOTE_PORT% -local %SS_LOCAL_HOST%:%SS_LOCAL_PORT% %SS_PLUGIN_OPTIONS%

which will be parsed into

start someplugin.exe -remote 1.2.3.4:9999 -local 127.0.0.2:33333 foobar

It should expand the selection of third-party plug-in programs.

@madeye
Copy link
Contributor

madeye commented Mar 29, 2018

The reason we use environment variable is to avoid special character issue in the command line, e.g key s like ^%$&^\/.

However, it's still worth to support CLI args in windows as some users would try to use non-SIP003 plugins.

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

No branches or pull requests

2 participants