chore(all): replace net.IP with netip.Addr

This commit is contained in:
Quentin McGaw
2023-05-20 19:58:18 +00:00
parent 00ee6ff9a7
commit 0a29337c3b
91 changed files with 525 additions and 590 deletions

View File

@@ -4,8 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"net/netip"
"github.com/qdm12/gluetun/internal/provider/common"
)
@@ -15,20 +15,20 @@ type apiData struct {
}
type apiServer struct {
PublicName string `json:"public_name"`
CountryName string `json:"country_name"`
CountryCode string `json:"country_code"`
Location string `json:"location"`
Continent string `json:"continent"`
IPv4In1 net.IP `json:"ip_v4_in1"`
IPv4In2 net.IP `json:"ip_v4_in2"`
IPv4In3 net.IP `json:"ip_v4_in3"`
IPv4In4 net.IP `json:"ip_v4_in4"`
IPv6In1 net.IP `json:"ip_v6_in1"`
IPv6In2 net.IP `json:"ip_v6_in2"`
IPv6In3 net.IP `json:"ip_v6_in3"`
IPv6In4 net.IP `json:"ip_v6_in4"`
Health string `json:"health"`
PublicName string `json:"public_name"`
CountryName string `json:"country_name"`
CountryCode string `json:"country_code"`
Location string `json:"location"`
Continent string `json:"continent"`
IPv4In1 netip.Addr `json:"ip_v4_in1"`
IPv4In2 netip.Addr `json:"ip_v4_in2"`
IPv4In3 netip.Addr `json:"ip_v4_in3"`
IPv4In4 netip.Addr `json:"ip_v4_in4"`
IPv6In1 netip.Addr `json:"ip_v6_in1"`
IPv6In2 netip.Addr `json:"ip_v6_in2"`
IPv6In3 netip.Addr `json:"ip_v6_in3"`
IPv6In4 netip.Addr `json:"ip_v6_in4"`
Health string `json:"health"`
}
func fetchAPI(ctx context.Context, client *http.Client) (