Spawn multiple gost instances in a single command with -- #713
+174
−73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Congratulations for this amazing tool 💯! It is my go-to whenever I need to create tunnels 🎉
Due to the fact I use socks over reverse-tunnels a lot, this PR allows a single gost command to perform multiple operations in separated instances.
This is easier to explain with a short example:
Before this PR this is what you had to do if you wanted to create a socks over reverse-SSH:
After this PR the client no longer needs to use multiple terminals/processes:
This works by spawning a different gost instance in a goroutine with each
--
, so there are no configuration conflicts ✨!You can certainly use multiple
--
to do all sort of craziness in a single gost command:Of course, some things could be improved as I didn't alter the main logic of gost which relies on the globals gost.DefaultTLSConfig, gost.Debug, and gost.SetLogger(). Among them,
gost.DefaultTLSConfig
is the most "damaging" one as it means that all the gost instances spawned with--
will use the same TLS certificate (which won't happen if multiple gost processes are separately run in different terminals/processes instead of using--
).For sure, there are several ways of isolating
gost.DefaultTLSConfig
(and the other globals) per instance, but changes outside the scope of this simple PR are needed and, for my usage purposes, a shared TLS cert (or global debug/log) is perfectly fine 🕺Finally, the README.md will need to be updated to include my README_en.md changes as I don't understand Chinese, unfortunately 😅