From 98ca305a5481c66743178a0679a6d8953d7faf53 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sat, 21 May 2022 00:34:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B9=B6=E5=8F=91dns=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=EF=BC=8C=E7=94=B1=E4=BA=8Eipv6=E9=98=BB=E5=A1=9E=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=9F=90=E4=BA=9B=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E4=B8=8D=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dns/resolver.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dns/resolver.go b/dns/resolver.go index e1fc90a5..abc686f4 100644 --- a/dns/resolver.go +++ b/dns/resolver.go @@ -82,12 +82,16 @@ func (r *Resolver) ResolveAllIP(host string) (ips []netip.Addr, err error) { ips, err = r.resolveIP(host, D.TypeA) - ipv6s, open := <-ch - if !open && err != nil { - return nil, resolver.ErrIPNotFound + select { + case ipv6s, open := <-ch: + if !open && err != nil { + return nil, resolver.ErrIPNotFound + } + ips = append(ips, ipv6s...) + case <-time.After(3 * time.Millisecond): + // wait ipv6 3ms } - ips = append(ips, ipv6s...) return ips, nil }