On Fri, Mar 15, 2019 at 8:31 AM Timofei Bredov <timofeibre...@gmail.com> wrote:
>
> Context: I use go version go1.12 linux/amd64. I have a VPN set up which has 
> private DNS server. This server can resolve URLs that have top level domain 
> name ".custom-tld".
>
> File /etc/resolvconf has the following content:
>
> nameserver 8.8.8.8
> nameserver 1.1.1.1
> nameserver 192.10.10.18
>
> When I try to use net.LookupSRV("", "", "service.name.custom-tld") it returns 
> "no such host" error because it tries the first server and then fails after 
> host name is not found. However local DNS resolver works as expected and 
> resolves the URL no problem.
>
> I have two questions:
>
> Should default DNS resolver for linux platform use every server in 
> /etc/resolvconf to try to lookup a URL?
> What is a better way to handle DNS resolution in that situation?

In general the Go resolver is intended to work like the historic C
resolver.  The historic C resolver will query one nameserver.  If that
nameserver times out, it will try the next one.  See "man
resolv.conf".  So if one of your name servers is returning "no such
host", then both the Go and C name servers will stop at that point.

One common approach for this situation would be to use a single
nameserver line and point it to a DNS server that replies with the
desired result for your special domain and otherwise forwards the
query to a normal caching resolver.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to