Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromRequest ¶
FromRequest identifies the remote ip from an http request
Types ¶
type IPInfo ¶
IPInfo maintains a cache to hold IpLookup information to avoid redundant network requests made for the same IP address.
func (*IPInfo) Cached ¶
Cached checks if the info for the ipAddr is present in the cache. If so we return the result from the cache itself.
func (*IPInfo) GetCoordinates ¶
GetCoordinates returns the formatted coordinates (both latitude and longitude) of the location fetched for IP.
type IPLookup ¶
type IPLookup struct {
City string `json:"city"`
Continent string `json:"continent"`
Country string `json:"country"`
CountryCode string `json:"countryCode"`
ISP string `json:"isp"`
Lat string `json:"lat"`
Lon string `json:"lon"`
Org string `json:"org"`
Query string `json:"query"`
Region string `json:"regionName"` // map to regionName provided by API
Status string `json:"status"`
}
IPLookup represents the response received from the ip-api service.
Click to show internal directories.
Click to hide internal directories.