Documentation ¶
Index ¶
Constants ¶
View Source
const ( // IP GeoLocation API. GEO_IP_API = "http://ip-api.com/json" // Default value to use in the GeoLocation struct. // This is used when the GEO_IP_API cannot be reached. DEFAULT_GEO_VAL = "Unknown" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeoLocation ¶
type GeoLocation struct { Country string `json:"country"` RegionName string `json:"region_name"` City string `json:"city"` ZipCode string `json:"zip_code"` ASNumber string `json:"as_number"` }
`GeoLocation` represents the information about a geographical location derived from an IP Address.
func GetGeoLocation ¶
func GetGeoLocation(ip string) (GeoLocation, error)
`GetGeoLocation` retrieves the geolocation information for the given IP address using the GEO_IP_API.
Click to show internal directories.
Click to hide internal directories.