Skip to content

Commit

Permalink
Fix: should check all ips need to fallback (#2915)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaling888 authored Sep 2, 2023
1 parent 1855e18 commit db2b5db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dns/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ func (r *Resolver) ipExchange(ctx context.Context, m *D.Msg) (msg *D.Msg, err er
res := <-msgCh
if res.Error == nil {
if ips := msgToIP(res.Msg); len(ips) != 0 {
if !r.shouldIPFallback(ips[0]) {
shouldNotFallback := lo.EveryBy(ips, func(ip net.IP) bool {
return !r.shouldIPFallback(ip)
})
if shouldNotFallback {
msg = res.Msg // no need to wait for fallback result
err = res.Error
return msg, err
Expand Down

0 comments on commit db2b5db

Please sign in to comment.