net/dnsfallback: do not attempt lookups of IPs.

Currently if the passed in host is an IP, Lookup still attempts to
resolve it with a dns server. This makes it just return the IP directly.

Updates tailscale/corp#4475

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/4284/head
Maisem Ali 2 years ago committed by Maisem Ali
parent b45bb577a0
commit b2f269d5b7

@ -27,6 +27,10 @@ import (
)
func Lookup(ctx context.Context, host string) ([]netaddr.IP, error) {
if ip, err := netaddr.ParseIP(host); err == nil && !ip.IsZero() {
return []netaddr.IP{ip}, nil
}
type nameIP struct {
dnsName string
ip netaddr.IP

Loading…
Cancel
Save