Skip to content

Commit

Permalink
fix: dns resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Mar 6, 2023
1 parent 6a97ab9 commit 7c34964
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions component/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ func LookupIPv4WithResolver(ctx context.Context, host string, r Resolver) ([]net
return r.LookupIPv4(ctx, host)
}

if DefaultResolver != nil {
return DefaultResolver.LookupIPv4(ctx, host)
}

ipAddrs, err := net.DefaultResolver.LookupNetIP(ctx, "ip4", host)
if err != nil {
return nil, err
Expand Down Expand Up @@ -126,9 +122,6 @@ func LookupIPv6WithResolver(ctx context.Context, host string, r Resolver) ([]net
if r != nil {
return r.LookupIPv6(ctx, host)
}
if DefaultResolver != nil {
return DefaultResolver.LookupIPv6(ctx, host)
}

ipAddrs, err := net.DefaultResolver.LookupNetIP(ctx, "ip6", host)
if err != nil {
Expand Down Expand Up @@ -172,7 +165,7 @@ func LookupIPWithResolver(ctx context.Context, host string, r Resolver) ([]netip
}
return r.LookupIP(ctx, host)
} else if DisableIPv6 {
return LookupIPv4(ctx, host)
return LookupIPv4WithResolver(ctx, host, r)
}

if ip, err := netip.ParseAddr(host); err == nil {
Expand Down

0 comments on commit 7c34964

Please sign in to comment.