【发布时间】:2016-06-16 19:46:04
【问题描述】:
我有一个应用程序,它是用 Go 编写的,它使用这个函数,但它总是无法解析 DNS 名称。我可以使用其他应用程序很好地解析服务器上的 DNS 名称,但不能使用使用此功能的基于 Go 的应用程序。
【问题讨论】:
-
尝试使用
GODEBUG=netdns=cgo运行应用程序
我有一个应用程序,它是用 Go 编写的,它使用这个函数,但它总是无法解析 DNS 名称。我可以使用其他应用程序很好地解析服务器上的 DNS 名称,但不能使用使用此功能的基于 Go 的应用程序。
【问题讨论】:
GODEBUG=netdns=cgo运行应用程序
如有疑问,请“使用来源,卢克”。阅读 dnsclient_unix.go 会发现它会遍历所有已配置的服务器。
但请注意:
// If answer errored for rcodes dnsRcodeSuccess or dnsRcodeNameError,
// it means the response in msg was not useful and trying another
// server probably won't help. Return now in those cases.
// TODO: indicate this in a more obvious way, such as a field on DNSError?
【讨论】: