Move code out of #main to support reuse in lib without patching (IPtProxy)
For Snowflake on mobile, we cannot compile an executable with gomobile
. Instead gomobile
only produces libraries.
While the new PluggableTransport 2.0 API is nice in theory, we unfortunately need to satisfy Tor, which needs a PT 1.0 interface via SOCKS.
So it's either we copy ~ 900 lines of code from client/snowflake.go and proxy/snowflake.go, patch that to our needs and then try to keep up with the changes, or we keep a patchfile around, apply that before builds and keep that up to date.
For the IPtProxy
library, it would be awesome if you could factor as much code as possible into a non-main namespace so we could use it without patching. Note: command line option parsing best stays in the #main
function.
Please see/apply our patchfile to understand, what would be most suitable!