Documentation
¶
Overview ¶
Package geolocation locates a server address through public IP geolocation services, filling in a server's country and city.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeoLocationResponse ¶
type GeoLocationResponse struct {
Country string `json:"country"`
CountryName string `json:"country_name"`
Region string `json:"region"`
City string `json:"city"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Loc string `json:"loc"`
}
GeoLocationResponse represents the geolocation data returned by the API.
func GetRegionByIp ¶
func GetRegionByIp(ctx context.Context, ip string) (*GeoLocationResponse, error)
GetRegionByIp queries the geolocation of an IP address using supported services, trying them in turn until one answers. Cancelling ctx aborts the lookups.
Click to show internal directories.
Click to hide internal directories.