tladesignz / IPtProxy

Obfs4proxy and Snowflake Pluggable Transports for iOS
MIT License
45 stars 11 forks source link

Add -trimpath to gomobile bind #38

Closed bitmold closed 1 year ago

bitmold commented 1 year ago

Just added this to OrbotLib, when you use go build (or gomobile bind) the binary contains full filepaths which you probably don't want (might leak information about the setup of your development machine)

For free it also produces a slightly smaller binary with no performance tradeoffs (in my case ~30KB)

-trimpath
                remove all file system paths from the resulting executable.
                Instead of absolute file system paths, the recorded file names
                will begin either a module path@version (when using modules),
                or a plain import path (when using the standard library, or GOPATH).
tladesignz commented 1 year ago

Goddamnit! Why are compilers doing that? Thanks for pointing it out.

However, I can still see some absolute paths in the dependency listing:

dep git.torproject.org/pluggable-transports/snowflake.git/v2    v2.5.1
=>  /Users/<username>/workspace/gp/IPtProxy/snowflake   (devel)

I'll modify the build script, so everything is run in a temp dir. Please review and improve!

tladesignz commented 1 year ago

Uuups. Sorry. Just recognized, this is a PR, not an issue. Anyway, check out the referenced commit!

bitmold commented 1 year ago

I wonder if you even needed to do that - Are those paths in the dependency graph part of the binary?

Either way i have no idea why that feature would be on by default in a compiler - ridiculous

tladesignz commented 1 year ago

That piece I mention earlier was actually copied from the binary. At least for Apple compilations, that's what happens.