Documentation ¶
Overview ¶
Package geo implements a location lookup by name or IP address.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Languages are the only name extracted from the // MaxMind database for searching by place name. Languages = []string{"en", "de", "fr", "es"} )
Functions ¶
func DownloadDB ¶
DownloadDB downloads URL to path
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB looks up location data by IP or city. It is a suture.Service and should be passed to a suture.Supervisor.
func New ¶
New DB. Reads MaxMind database at dbPath and saves its own data in dir. Both must exist when Open() or Serve() is called.
type Location ¶
type Location struct { Town string `json:"town" xml:"town"` Region string `json:"region" xml:"region"` Country string `json:"country" xml:"country"` Postcode string `json:"postcode" xml:"postcode"` Timezone string `json:"timezone" xml:"timezone"` Latitude float64 `json:"latitude" xml:"latitude"` Longitude float64 `json:"longitude" xml:"longitude"` }
Location is the structure returned by the API.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater checks for an update to the database every 12 hours. Updater is a suture.Service and should be managed by a suture.Supervisor.
func NewUpdater ¶
NewUpdater creates an initialised Updater.
Click to show internal directories.
Click to hide internal directories.