-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
net: Support the /etc/resolver DNS resolution configuration hierarchy on OS X when cgo is disabled #12524
Comments
I don't think Go-native DNS resolving mechanism is used on Mac. addrs, err := net.LookupHost("google.com") on my Mac. If I enable debugging (
which means that OS-native DNS resolving is used. Can you supply an exact configuration file, Go code, actual and expected output? |
@nodirt This is for a binary with cgo off. |
If cgo is disabled then the pure go DNS resolver will be used. If you want On Mon, 7 Sep 2015 07:47 Jonathan Rudenberg notifications@github.com
|
Shouldn't be a problem since this is needed only on a dev machine. On Sun, Sep 6, 2015 at 4:06 PM Dave Cheney notifications@github.com wrote:
|
In this specific case, @Rotonen was using the Flynn binary that we distribute as a compiled artifact, it is compiled without cgo to ease cross-compilation. Just because the user is a developer doesn't mean that they are a Go developer or want to compile the binary for themselves. The only question here is if this feature is out of scope for the pure-Go resolver. |
cross compilation with cgo-enabled net package is not that hard.
You can reuse the package contained in binary distribution and
force internal linking.
|
I don't see anything wrong with supporting the OS X /etc/resolver directory. That said, my understanding is that the Go DNS resolver does not work well on most OS X machines. That is why it is disabled by default. |
This would be great in all platforms anyway. Is there any disadvantage from supporting this behaviour? It seems that it'd neatly resolve the need to install and configure dnsmasq to provide the simple function of having different resolvers for different TLDs. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Any updates would be posted here. No updates have been posted here. |
See |
Just stumbled upon this today while attempting to use coredns as a dns proxy for local development. It's a real bummer to discover how naive our support for os x is. |
We've generally assumed people use cgo on Darwin, so this bug has never been a priority. I do admit that practically means that Darwin binaries need to be built on Darwin, which is difficult for people wanting to cross-compile for a dozen platforms as part of their release process. Perhaps on Darwin without cgo we could just shell out to a program to do DNS resolution (e.g. host, dig, nslookup?). At least |
Probably best to discuss further on a patch submission. Thanks. |
Change https://go.dev/cl/448020 mentions this issue: |
Support for direct libc calls was added in CL 446178 but the build tags weren't quite activating it when cgo was not enabled. Adjust them and add a new supporting file for darwin. This should use the new direct libc calls with both CGO_ENABLED=0 and CGO_ENABLED=1 when building for darwin. Updates #12524 Change-Id: Ieee4b298dee13f389ed3a63c0a4a3a18c9180163 Reviewed-on: https://go-review.googlesource.com/c/go/+/448020 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Dan Peterson <danp@danp.net> Auto-Submit: Ian Lance Taylor <iant@google.com>
@bradfitz I may reach out, thank you! I'm not sure if we're ready to take on maintaining a fork, but you've piqued my interest. |
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/resolver.5.html
OS X allows you to add TLD specific resolver configurations. Quite popular ones are /etc/resolver/vm for local virtual machines and /etc/resolver/dev for local development purposes.
https://golang.org/src/net/dnsclient_unix.go#L231
Go seems to be hardcoded to only take /etc/resolv.conf into account on Unix platforms.
The text was updated successfully, but these errors were encountered: