dqmchw0071 2016-08-15 16:31
浏览 486
已采纳

在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

  • 写回答

2条回答 默认 最新

  • dtpa98038 2018-03-16 07:47
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件