I am running a CLI based on Golang
While trying to connect any URLs I got this Below Error
Error: Get https://google.com/version: dial tcp: lookup google.com on [::1]:53: read udp [::1]:48773->[::1]:53: read: connection refused
Is your program compiled with GOOS=android ?
Golang programs compiled for target "linux" will have problems with DNS resolver and should be recompiled for Android in order to be usable in Termux.
DNS Resolver is 8.8.8.8
CLI I am Installing - https://github.com/gotify/cli
Worked on Ubuntu system but not in Termux
DNS Resolver is聽8.8.8.8
This not a DNS resolver !
DNS resolver is part of code that handles DNS queries. Typically handled via CGO calls to C library: GNU libc on Linux and Bionic on Android. They are incompatible.
Note that static linking of the executable does not have any effect. Resolver from GNU libc always used via dlopen(). That is why it works in Ubuntu but not in Termux.
@xeffyr Any Solution for this?
If CGO was disabled at build time, binary will look for file /etc/resolv.conf. In such case you should be able to run binary with termux-chroot from package proot (package resolv-conf may be needed too).
Perhaps it may be easier to recompile it on device. Do:
pkg install golang
go get github.com/gotify/cli
Binary "cli" will be available at ~/go/bin.
Other workarounds are not exist: either use binary in environment it was compiled for or recompile binary for Termux.
termux-chroot
Connects the URL Successfully
but got this below error (Using Binary file arm64)
user: Current not Implemented on linux/arm64
Current not Implemented on linux/arm64
Try to use a binary compiled specially for Termux/android: gotify-cli.gz (arm64).
Thanks let me try and Update
Thanks a lot, it's working
Perhaps it may be easier to recompile it on device. Do:
pkg install golang go get github.com/gotify/cliBinary "cli" will be available at
~/go/bin.Other workarounds are not exist: either use binary in environment it was compiled for or recompile binary for Termux.
Follow this step working
Most helpful comment
If CGO was disabled at build time, binary will look for file /etc/resolv.conf. In such case you should be able to run binary with
termux-chrootfrom packageproot(packageresolv-confmay be needed too).