fix: potential dns leaking in the very beginning

This commit is contained in:
mzz2017 2023-02-27 14:47:20 +08:00
parent 2525c0658d
commit 203e824ccf

View File

@ -73,6 +73,9 @@ func New(log *logrus.Logger, dns *config.Dns, opt *NewOption) (s *Dns, err error
}
upstreamName2Id[tag] = uint8(len(s.upstream))
s.upstream = append(s.upstream, r)
// Init immediately to avoid DNS leaking in the very beginning because param control_plane_dns_routing will
// be set in callback.
go r.GetUpstream()
}
// Optimize routings.
if dns.Routing.Request.Rules, err = routing.ApplyRulesOptimizers(dns.Routing.Request.Rules,