From 66afda488bae1441ee65b1985811dc7d4dc8c37e Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 14 Apr 2021 19:03:59 +0300 Subject: [PATCH] allow overriding implicit defaults with the default resolver License: MIT Signed-off-by: vyzo --- core/node/dns.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/node/dns.go b/core/node/dns.go index 39b870e704e..408f08a4c1c 100644 --- a/core/node/dns.go +++ b/core/node/dns.go @@ -36,6 +36,12 @@ func DNSResolver(cfg *config.Config) (*madns.Resolver, error) { return nil, fmt.Errorf("invalid domain %s; must be FQDN", domain) } + domains[domain] = struct{}{} + if url == "" { + // allow overriding of implicit defaults with the default resolver + continue + } + rslv, ok := rslvrs[url] if !ok { rslv, err = newResolver(url) @@ -50,8 +56,6 @@ func DNSResolver(cfg *config.Config) (*madns.Resolver, error) { } else { opts = append(opts, madns.WithDefaultResolver(rslv)) } - - domains[domain] = struct{}{} } // fill in defaults if not overriden by the user