mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Always use ctrld bootstrap nameserver for ResolverTypeOS
So in case no nameservers can be found, default OS resolver could still resolve queries.
This commit is contained in:
committed by
Cuong Manh Le
parent
6028b8f186
commit
073af0f89c
14
resolver.go
14
resolver.go
@@ -27,13 +27,15 @@ const (
|
||||
)
|
||||
|
||||
var bootstrapDNS = "76.76.2.0"
|
||||
var or = &osResolver{nameservers: nameservers()}
|
||||
|
||||
func init() {
|
||||
if len(or.nameservers) == 0 {
|
||||
// Add bootstrap DNS in case we did not find any.
|
||||
or.nameservers = []string{net.JoinHostPort(bootstrapDNS, "53")}
|
||||
}
|
||||
// or is the Resolver used for ResolverTypeOS.
|
||||
var or = &osResolver{nameservers: defaultNameservers()}
|
||||
|
||||
// defaultNameservers returns OS nameservers plus ctrld bootstrap nameserver.
|
||||
func defaultNameservers() []string {
|
||||
ns := nameservers()
|
||||
ns = append(ns, net.JoinHostPort(bootstrapDNS, "53"))
|
||||
return ns
|
||||
}
|
||||
|
||||
// Resolver is the interface that wraps the basic DNS operations.
|
||||
|
||||
Reference in New Issue
Block a user