Pull request 1992: 3701-fallback-dns-check
Squashed commit of the following:
commit a5191def0b950cb7ab1ea737e9c8c6e8b65ec720
Merge: 7d127bfca 5bd452516
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Wed Sep 6 12:21:08 2023 +0300
Merge branch 'master' into 3701-fallback-dns-check
commit 7d127bfca54ac940c611681e6f48b89881491602
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Sep 5 13:21:35 2023 +0300
client: add fallback_dns to the upstream test
commit 970da7215503b5f05c53fcad47c715a96d9fc3c4
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Mon Sep 4 19:23:35 2023 +0300
all: add fallback dns check
This commit is contained in:
@@ -392,6 +392,7 @@ func (s *Server) setConfigRestartable(dc *jsonDNSConfig) (shouldRestart bool) {
|
||||
type upstreamJSON struct {
|
||||
Upstreams []string `json:"upstream_dns"`
|
||||
BootstrapDNS []string `json:"bootstrap_dns"`
|
||||
FallbackDNS []string `json:"fallback_dns"`
|
||||
PrivateUpstreams []string `json:"private_upstream"`
|
||||
}
|
||||
|
||||
@@ -750,11 +751,10 @@ func (s *Server) handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) {
|
||||
req.Upstreams = stringutil.FilterOut(req.Upstreams, IsCommentOrEmpty)
|
||||
req.PrivateUpstreams = stringutil.FilterOut(req.PrivateUpstreams, IsCommentOrEmpty)
|
||||
|
||||
upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
|
||||
upsNum := len(req.Upstreams) + len(req.FallbackDNS) + len(req.PrivateUpstreams)
|
||||
result := make(map[string]string, upsNum)
|
||||
resCh := make(chan upsCheckResult, upsNum)
|
||||
|
||||
// TODO(s.chzhen): Check fallback DNS servers.
|
||||
for _, ups := range req.Upstreams {
|
||||
go func(ups string) {
|
||||
resCh <- upsCheckResult{
|
||||
@@ -763,6 +763,14 @@ func (s *Server) handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}(ups)
|
||||
}
|
||||
for _, ups := range req.FallbackDNS {
|
||||
go func(ups string) {
|
||||
resCh <- upsCheckResult{
|
||||
host: ups,
|
||||
err: s.checkDNS(ups, opts, checkDNSUpstreamExc),
|
||||
}
|
||||
}(ups)
|
||||
}
|
||||
for _, ups := range req.PrivateUpstreams {
|
||||
go func(ups string) {
|
||||
resCh <- upsCheckResult{
|
||||
|
||||
Reference in New Issue
Block a user