Skip to content

Commit db2b5db

Browse files
authored
Fix: should check all ips need to fallback (#2915)
1 parent 1855e18 commit db2b5db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dns/resolver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ func (r *Resolver) ipExchange(ctx context.Context, m *D.Msg) (msg *D.Msg, err er
265265
res := <-msgCh
266266
if res.Error == nil {
267267
if ips := msgToIP(res.Msg); len(ips) != 0 {
268-
if !r.shouldIPFallback(ips[0]) {
268+
shouldNotFallback := lo.EveryBy(ips, func(ip net.IP) bool {
269+
return !r.shouldIPFallback(ip)
270+
})
271+
if shouldNotFallback {
269272
msg = res.Msg // no need to wait for fallback result
270273
err = res.Error
271274
return msg, err

0 commit comments

Comments
 (0)