Documentation
¶
Overview ¶
Package geojs is the library behind the geojs command line: the HTTP client, request shaping, and typed data models for the GeoJS API (https://get.geojs.io/).
No API key is required. The Client paces requests, sets a real User-Agent, and retries transient failures (429 and 5xx).
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every API request is built from.
const Host = "get.geojs.io"
Host is the API hostname.
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 GeoJS API.
type Config ¶
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 ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the geojs driver. It carries no state; the per-run client is built by the factory Register hands kit.
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 GeoInfo ¶
type GeoInfo struct {
IP string `json:"ip" kit:"id"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Region string `json:"region"`
City string `json:"city"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Timezone string `json:"timezone"`
ASN string `json:"asn"`
Organization string `json:"organization"`
}
GeoInfo holds geolocation data for an IP address.