allow overriding implicit defaults with the default resolver

License: MIT
Signed-off-by: vyzo <vyzo@hackzen.org>
This commit is contained in:
vyzo 2021-04-14 19:03:59 +03:00 committed by Steven Allen
parent 35fe392491
commit 0b4037c7cd

View File

@ -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