diff --git a/component/dns/dns.go b/component/dns/dns.go index 71096e6..e2b8358 100644 --- a/component/dns/dns.go +++ b/component/dns/dns.go @@ -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,