Documentation
¶
Overview ¶
Package ipapi is the library behind the ipapi command line: the HTTP client, request shaping, and the typed data models for the ip-api.com IP geolocation API.
No API key or authentication is required. The free tier is limited to 45 requests per minute. Note: the free tier uses HTTP (not HTTPS).
Index ¶
Constants ¶
const ( // DefaultUserAgent identifies the client to the server. DefaultUserAgent = "ipapi-cli/dev (+https://github.com/tamnd/ipapi-cli)" // Host is the site this client talks to. Host = "ip-api.com" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the ip-api.com API over HTTP.
type Config ¶ added in v0.1.1
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for the ip-api.com API. Note: the free tier uses HTTP (not HTTPS) and is rate-limited to 45 req/min.
type Domain ¶
type Domain struct{}
Domain is the ipapi driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type IPInfo ¶ added in v0.1.1
type IPInfo struct {
Query string `json:"query" kit:"id"`
Status string `json:"status"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
RegionName string `json:"region_name"`
City string `json:"city"`
Zip string `json:"zip"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
Timezone string `json:"timezone"`
ISP string `json:"isp"`
Org string `json:"org"`
AS string `json:"as"`
}
IPInfo holds geolocation data for an IP address.