fix: pure ip resolve
This commit is contained in:
parent
6e7002dbd3
commit
e1c6142851
1 changed files with 10 additions and 10 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue