getlantern / browsersunbounded

Interoperable browser-based P2P proxies for censorship circumvention
GNU General Public License v3.0
16 stars 0 forks source link

Test Broflake's "desktop" client variant on Android #42

Closed soltzen closed 1 year ago

soltzen commented 1 year ago

Broflake client codebase using the desktop variant of the binary was tested so far with OSX machines.

We're packaging this project into Flashlight which means it'll exist in Lantern's Android client automagically as soon as it's included in Flashlight (No issue but PR to make the project into a library to fit Flashlight is here).

I doubt there'll be a difference in functionality but it's important to test the codebase on Android.

Here're the steps:

CC @noahlevenson

Deliverables

https://github.com/getlantern/broflake/pull/46

soltzen commented 1 year ago

Tldr

Broflake's desktop client works on Android without any extra modifications.

Not Tldr

I made an Android project and used this Makefile to build a modified version of the desktop variant for mobile:

.PHONY: build-mobile
build-mobile: install-gomobile
    @echo "Building mobile app"
    (cd ./client/android/go; \
    go get golang.org/x/mobile/bind@latest && \
    gomobile bind -target=android -androidapi=19 .)

.PHONY: install-gomobile
install-gomobile:
    @echo "installing gomobile"
    @go install golang.org/x/mobile/cmd/gomobile@latest
    @echo "initializing gomobile"
    gomobile init

The modified version is a copy-paste of the original client code but with the package name changed to something other than main since gomobile doesn't compile packages that has main in it.

There was a bug that I poked @noahlevenson about, but it was just related to running the start() method twice from Android's code. For whatever reason, the thread{ } call I made in the dummy Android project called start() twice which causes race issues since global variables in the package are re-used

Conclusion

All works but, since we're using global vars and won't stop, it'll be cool to make a global boolean guard so start() or stop() doesn't get called twice, which causes major issues.

@noahlevenson I made a PR for the start/stop guard. I'll close the issue after we resolve it there.

PR https://github.com/getlantern/broflake/pull/46

soltzen commented 1 year ago

The start/stop guard will be addressed here so I'm closing this. It's done