在Termux中运行Go应用时出现DNS查找问题

I am trying to write a Go App that lets me spawn Digital Ocean droplets. It works fine on my desktop and laptop, but when I try to run it on my Android phone in Termux I get the issue shown in the image. I already filed an issue on their GitHub, but I am not sure if this is related to Termux or if I am missing something.

Here is part of the error:

dial tcp: lookup api.digitalocean.com on [::1]:53: read udp [::1]:39143->[::1]:53: read: connection refused

Not sure why it is trying to use localhost as a dns server. Here is an image:

Image in question

Just create /etc/resolv.conf and append nameserver 8.8.8.8 then this problem will be resolved.

According to src/net/dnsclient_unix.go, if /etc/resolv.conf is absent, localhost:53 is chosen as a name server.

Since the Linux in Android is not so "standard". /etc/resolv.conf is not available. The app then just keep looking up host in localhost:53.

Your phone is trying to connect to itself: [::1]:39143->[::1]:53

My guess is your phone is probably not running a local DNS server and so you get the connection refused error.

Your nslookup is irrelevant because you connected directly to 8.8.8.8. Instead, try nslookup ::1 or dig @::1 google.com A