net/dns/publicdns: add missing call to sync.Once.Do (#4410)

Signed-off-by: Jenny Zhang <jz@tailscale.com>
This commit is contained in:
phirework 2022-04-14 17:45:58 -04:00 committed by GitHub
parent 83c734a6e0
commit 52d32c94d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ func DoHIPsOfBase() map[string][]netaddr.IP {
// DoHV6 returns the first IPv6 DNS address from a given public DNS provider
// if found, along with a boolean indicating success.
func DoHV6(base string) (ip netaddr.IP, ok bool) {
populateOnce.Do(populate)
for _, ip := range dohIPsOfBase[base] {
if ip.Is6() {
return ip, true