orbot icon indicating copy to clipboard operation
orbot copied to clipboard

Explore the use of leaf instead fo go-tun2socks for both consistency and efficiency

Open eycorsican opened this issue 2 years ago • 4 comments

Since go-tun2socks is no longer maintained, and due to the inefficiency of cgo, the better alternative is leaf, which is also used by orbot-ios. Note leaf can be invoked from Go as a static library: https://github.com/eycorsican/leaf/issues/104

eycorsican avatar Mar 06 '22 05:03 eycorsican

Big fan @eycorsican ! :)

We started with leaf, and had some concerns around resulting total binary size. Any thoughts on what a reasonable arm64 build of leaf, say for Android or iOS should be in terms of size?

@bitmold @tladesignz

n8fr8 avatar Mar 06 '22 14:03 n8fr8

I'm also a big fan ~ I'm curious to experiment more with it in the future, and frankly I never experimented with leaf as much as I'd have liked to when we were migrating away from our old buggy C++ tun2socks implementation.

When there's time to revisit leaf, I'll post more here. I appreciate you nudging us on to a more maintained codebase

bitmold avatar Mar 06 '22 14:03 bitmold

@n8fr8 It might have been related in part to the issue @eycorsican posted on the iOS app too: https://github.com/guardianproject/orbot-ios/issues/6

bitmold avatar Mar 06 '22 15:03 bitmold

@n8fr8 yah, as @bitmold mentioned above, with that feature set the size of a .so file is 9.4MB for arm64 (debugging symbols stripped).

It can be further reduced to 8.4MB by using leaf/config-json instead of leaf/config-conf because the conf format brings in a big dependency regex which is much bigger compares to a json parser. However the tun-fd option is missing in the json config as I never mind using this format for client applications.

eycorsican avatar Mar 08 '22 10:03 eycorsican