diff --git a/component/resolver/resolver.go b/component/resolver/resolver.go index d2c036d5..38412562 100644 --- a/component/resolver/resolver.go +++ b/component/resolver/resolver.go @@ -209,6 +209,11 @@ func ResolveAllIPWithResolver(host string, r Resolver) ([]netip.Addr, error) { return []netip.Addr{node.Data}, nil } + ip, err := netip.ParseAddr(host) + if err == nil { + return []netip.Addr{ip}, nil + } + if r != nil { if DisableIPv6 { return r.ResolveAllIPv4(host) @@ -219,11 +224,6 @@ func ResolveAllIPWithResolver(host string, r Resolver) ([]netip.Addr, error) { return ResolveAllIPv4(host) } - ip, err := netip.ParseAddr(host) - if err == nil { - return []netip.Addr{ip}, nil - } - if DefaultResolver == nil { ipAddr, err := net.ResolveIPAddr("ip", host) if err != nil { @@ -241,6 +241,11 @@ func ResolveAllIPPrimaryIPv4WithResolver(host string, r Resolver) ([]netip.Addr, return []netip.Addr{node.Data}, nil } + ip, err := netip.ParseAddr(host) + if err == nil { + return []netip.Addr{ip}, nil + } + if r != nil { if DisableIPv6 { return r.ResolveAllIPv4(host) @@ -251,11 +256,6 @@ func ResolveAllIPPrimaryIPv4WithResolver(host string, r Resolver) ([]netip.Addr, return ResolveAllIPv4(host) } - ip, err := netip.ParseAddr(host) - if err == nil { - return []netip.Addr{ip}, nil - } - if DefaultResolver == nil { ipAddr, err := net.ResolveIPAddr("ip", host) if err != nil {