Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work on Android that are Linux too. #8

Closed
SirSAC opened this issue Mar 15, 2021 · 24 comments
Closed

Not work on Android that are Linux too. #8

SirSAC opened this issue Mar 15, 2021 · 24 comments

Comments

@SirSAC
Copy link

SirSAC commented Mar 15, 2021

Hi, im Alex and i have your open source project that i work on it for more options, more stable and complex but in sametime simple and light, the problem is syscall.BindToDevice not work on Android but wikipedia saids is Linux too, thats normal or needs different code for this system?
PS: I love your work man, i very appreciate and thanks for open source and MIT license, when i will have some money i will donate to you.

@SirSAC SirSAC changed the title Not work on Android that are linux too. Not work on Android that are Linux too. Mar 15, 2021
@extremecoders-re
Copy link
Owner

Is there any specific error message when running on Android?

@SirSAC
Copy link
Author

SirSAC commented Mar 16, 2021

no, just the syscall.BindToDevice return non nil value (err), i have root on my phone with Magisk and i have busybox and extras, i have Android 9 close to stock rom, my phone support aarch64 (ARM v8-A).

@SirSAC
Copy link
Author

SirSAC commented Mar 23, 2021

so, you have any idea how we can try to make compatible with Android?

@extremecoders-re
Copy link
Owner

Didn't get a chance to work on this yet. How are you compiling for Android? I think GOOS must be set to android rather than linux.

@SirSAC
Copy link
Author

SirSAC commented Mar 24, 2021

yes, i did it as GOOS=android and GOARCH=arm64 because my phone have 64-bit processor (ARM-v8) and is rooted with Magisk but not work on the syscall.BindToDevice as work on computer Linux, on net.DialTCP not work at all on Android, i try with different methods and commands to can be working on Android but at this moment i not have positive results, if i have one i will tell you that.
By the way, i found an issue about on how Linux works on firewall thing that make this program to be stuck on only one network and it can be fixed by running this command sudo sysctl --write net.ipv4.conf.all.rp_filter="0", add it below of setcap command.
Cya later, have a nice day and good luck with Android things, im waiting you about Android issue if you have any results or doubts.

@extremecoders-re
Copy link
Owner

Tested go-dispatch-proxy on an Android emulator and it's working fine. It's for x86 though not ARM. Traffic is dispatched across two interfaces.

Command used to compile (Requires Android NDK)

x86

$ CGO_ENABLED=1 CC=~/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android28-clang GOOS=android GOARCH=386 go build

ARM64

$ CGO_ENABLED=1 CC=~/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang GOOS=android GOARCH=arm64 go build

The ARM64 version hasn't been tested. Binaries attached.

go-dispatch-proxy-android-x86.zip
go-dispatch-proxy-android-arm64.zip

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

I will test it now and i will tell you if is working or not.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Nope, on arm64 or on arm in general not work, the error message is:
[WARN] 23.239.16.110:443 -> 10.24.161.221:0 {dial tcp4 10.24.161.221:0->23.239.16.110:443: connect: software caused connection abort}
[WARN] 23.239.16.110:443 -> 192.168.1.3:0 {dial tcp4 192.168.1.3:0->23.239.16.110:443: connect: software caused connection abort}
and this is repeated for any address.

@extremecoders-re
Copy link
Owner

Are you running it with root privileges?

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Yes, with su -c ./go-dispatch-proxy

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

I think is the problem is ARM not code, but im not sure.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

I have setcap too by termux and not work too with this.

@extremecoders-re
Copy link
Owner

Can you test if it works on an Android emulator?
Here there were no such errors when I tested it on Android Studio emulator.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

btw, golang have builtin android compiler, so, is not necessary to an external compiler.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

I tested on my phone that is android 9 (Pie) AOSP and is rooted with Magisk.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Can you test if it works on an Android emulator?
Here there were no such errors when I tested it on Android Studio emulator.

My PC is low end and i not think so, my CPU is E8200 and 4 GB of RAM of DDR2.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

You said you not tested for ARM64 but tested the x86 on emulator.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Can give me the link of website of iso or img for x86 Android?

@extremecoders-re
Copy link
Owner

golang have builtin android compiler, so, is not necessary to an external compile

About this. AFAIK Setting GOOS=android does require external compiler. It's mentioned in https://golang.org/misc/android/README

you not tested for ARM64 but tested the x86 on emulator

Yep, Just tested the x86 version

Can give me the link of website of iso or img for x86 Android?

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Thanks, i compiled the other programs for Android on ARM64 and i not have any problems with builtin compiler.

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Do not forget to mention this command for some Linux systems that have an conflict with this program.
Command that can fix this is sudo sysctl --write net.ipv4.conf.all.rp_filter=0

@SirSAC
Copy link
Author

SirSAC commented Mar 26, 2021

Ubuntu or Debian based systems have this conflict in general.

@SirSAC
Copy link
Author

SirSAC commented May 9, 2021

Hello again, did you find an workaround for Android on ARM processors?
On the Android with x86 processors i not see any problems.

@SirSAC
Copy link
Author

SirSAC commented Dec 6, 2021

Hello again, i fixed the problem on Android, the real problem was ARM not the system, so ARM thinks different and need to have IP address instead of site or web address. Thanks anticipated for trying to help me.

@SirSAC SirSAC closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants