diff --git a/internal/publicip/ipinfo/fetch.go b/internal/publicip/ipinfo/fetch.go index 306c71253..4190a325e 100644 --- a/internal/publicip/ipinfo/fetch.go +++ b/internal/publicip/ipinfo/fetch.go @@ -32,10 +32,12 @@ var ( // of the machine is used as the IP. func (f *Fetch) FetchInfo(ctx context.Context, ip netip.Addr) ( result Response, err error) { - const baseURL = "https://ipinfo.io/" - url := baseURL - if ip.IsValid() { - url += ip.String() + url := "https://ipinfo.io/" + switch { + case ip.Is6(): + url = "https://v6.ipinfo.io/" + ip.String() + case ip.Is4(): + url = "https://ipinfo.io/" + ip.String() } request, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)