-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Q: Possible to use an arbitrary tunnelling program as plugin by passing CLI args? #3064
Comments
Also I would like to clarify that by running However as you can imagine this is quite a complicated setup, not to mention that I need to keep many instances of the tunnelling program running (each connecting to a different server) if I want to hot-swap servers in Shadowsocks. I would love to take full advantage of Shadowsocks's built-in plugin system if possible. |
Read the SIP003 specifications my friend. You may want to make a change to upstream or write a wrapper to adapt to SIP003 specification. If not, you can roll your own wheels. |
I'm specifically asking for a way to circumvent that, if possible. And if not possible, what technical reason is preventing me from doing that? |
The root cause is that plugins work as slave process of Shadowsocks-Windows. Shadowsocks windows will have its own listening port and, when the connection is established, the wrapped Shadowsocks payload will be sent to the slave port, where the slave listening port is passed by shadowsocks-windows/Shadowsocks.WPF/Services/Sip003Plugin.cs Lines 95 to 100 in 14dc1a2
The port is generated, not hardcoded, so your method won't work at all. The only non-intrusive to Shadowsocks-windows way is to wrap your tunnel program. Finally, the exact technical reason is that you have to make your own wheels if you don't follow the standards and specifications. |
But actually, maybe Shadowsocks-Windows can consider introducing some variable substitution mechanism to enable use cases like that. For example, if we would replace Update: I saw the invocation of Example Commandline:
|
Yep that was what I suspected too. You worded it much clearer than I did though.
Oh that's just wonderful. Funnily enough, I was going to suggest some similar var substitution system too, had this not been the case. ... And I tested it with both the example program |
One extra thingShould we perhaps consider documenting this env substitution behaviour in |
I see your point. But before that, we must have documentation first. Currently I don't see one. |
Maybe we could extend SIP003 for supporting customization of plugins' listen port. |
Since almost all SIP003 plugins that are being actively maintained have UDP support, we should add UDP to SIP003 as well. |
Apologies. I just realised that I have overlooked a pretty prominent page in SS-Windows Wiki written in 2019 or earlier. It literally answers my question with comprehensive explanations and examples. Working with non SIP003 standard Plugin I will now close this issue out of unnecessity and a sliver of shame. |
No need to apologize. Repository wiki is not a good place for docs anyway. I'd like to keep the issue open, so I won't forget when I start to refactor the related code. |
@zonyitoo Out of curiosity, seen that you are the primary contributor to |
Nope. shadowsocks-rust only supports standard SIP003 plugins. And yes, you will have to make a wrapper program. |
😊 |
1 similar comment
😊 |
I am attempting to use an arbitrary tunnelling program as the plugin of
ss-windows
. This program does not implement SIP003, so until now I have been running it as a standalone program. However, after reading the SIP003 standard and seeing its simplicity, I was wondering whether it is possible to manually configure the tunnelling program usingss-windows
's "CLI parameters", thereby bypassing the need to write a custom adapter for it.For simplicity's sake, let's take this simple tunnelling program as an example: gnolizuh/quictun. My actual program works similarly to this example.
This program (on the client side) takes two parameters:
-l <local_addr>:<local_port>
and-r <remote_addr>:<remote_port>
. If I understand correctly, these parameters are one-to-one mapping of the required ENV parameters described in SIP003:SS_REMOTE_HOST
,SS_REMOTE_PORT
,SS_LOCAL_HOST
andSS_LOCAL_PORT
. Therefore something like the following should work:... and I can just ignore those four ENVs.
However when I attempt to start Shadowsocks with this configuration, I was prompted that the port is occupied. Therefore I suspected that maybe
ss-windows
is handling the local port configuration a little differently than I thought. Can you please confirm whether this is or isn't the case? In addition, would it be possible to configure a tunnelling program (that was not specifically designed to comply with SIP003) to run as a plugin this way? If so, how?The text was updated successfully, but these errors were encountered: