Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetLocation gets the location for the given IP address or the // IP of the server if blank. GetLocation(ctx context.Context, ip string) (*WorldLocation, error) // Name provides a client name used to report health check issues. Name() string // Ping checks the client is healthy. Ping(ctx context.Context) error }
Client is the ipapi client interface. It implements a simple in-memory transparent cache to avoid hitting the API too often and getting throttled (429).
type WorldLocation ¶
type WorldLocation struct { // Lat is the latitude of the location. Lat float64 `json:"lat"` // Long is the longitude of the location. Long float64 `json:"lon"` // City is the city of the location. City string `json:"city"` // Region is the region/state of the location. Region string `json:"region"` // Country is the country of the location. Country string `json:"country"` }
WorldLocation represents the geographical location of an IP address.
Click to show internal directories.
Click to hide internal directories.