fix: potential panic and check upstreams format before using them

This commit is contained in:
mzz2017
2023-03-21 18:27:30 +08:00
parent 948cfd3f7f
commit 4592be2320
5 changed files with 41 additions and 12 deletions

View File

@ -381,6 +381,9 @@ func NewControlPlane(
// Init immediately to avoid DNS leaking in the very beginning because param control_plane_dns_routing will
// be set in callback.
if err = dnsUpstream.CheckUpstreamsFormat(); err != nil {
return nil, err
}
go dnsUpstream.InitUpstreams()
close(plane.ready)