mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02:00
all: rework routers ntp waiting mechanism
Currently, on routers that require NTP waiting, ctrld makes the cleanup process, and restart dnsmasq for restoring default DNS config, so ntpd can query the NTP servers. It did work, but the code will depends on router platforms. Instead, we can spawn a plain DNS listener before PreRun on routers, this listener will serve NTP dns queries and once ntp is configured, the listener is terminated and ctrld will start serving using its configured upstreams. While at it, also fix the userHomeDir function on freshtomato, which must return the binary directory for routers that requires JFFS.
This commit is contained in:
committed by
Cuong Manh Le
parent
2d950eecdf
commit
1cd54a48e9
+14
@@ -201,3 +201,17 @@ func lookupIP(domain string, timeout int, withBootstrapDNS bool) (ips []string)
|
||||
}
|
||||
return ips
|
||||
}
|
||||
|
||||
// NewBootstrapResolver returns an OS resolver, which use following nameservers:
|
||||
//
|
||||
// - ControlD bootstrap DNS server.
|
||||
// - Gateway IP address (depends on OS).
|
||||
// - Input servers.
|
||||
func NewBootstrapResolver(servers ...string) Resolver {
|
||||
resolver := &osResolver{nameservers: nameservers()}
|
||||
resolver.nameservers = append([]string{net.JoinHostPort(bootstrapDNS, "53")}, resolver.nameservers...)
|
||||
for _, ns := range servers {
|
||||
resolver.nameservers = append([]string{net.JoinHostPort(ns, "53")}, resolver.nameservers...)
|
||||
}
|
||||
return resolver
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user