From c4efa1ab97892359feba6eca388e14c909371170 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 11 Jun 2025 22:23:24 +0700 Subject: [PATCH] Initializing default os resolver during upstream bootstrap Since calling defaultNameservers may block the whole bootstrap process if there's no valid DNS servers available. --- config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index fdea19f..96f6686 100644 --- a/config.go +++ b/config.go @@ -437,8 +437,9 @@ func (uc *UpstreamConfig) UID() string { func (uc *UpstreamConfig) SetupBootstrapIP() { b := backoff.NewBackoff("setupBootstrapIP", func(format string, args ...any) {}, 10*time.Second) isControlD := uc.IsControlD() + nss := initDefaultOsResolver() for { - uc.bootstrapIPs = lookupIP(uc.Domain, uc.Timeout, defaultNameservers()) + uc.bootstrapIPs = lookupIP(uc.Domain, uc.Timeout, nss) // For ControlD upstream, the bootstrap IPs could not be RFC 1918 addresses, // filtering them out here to prevent weird behavior. if isControlD {