Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeoDB ¶
type GeoDB struct {
// contains filtered or unexported fields
}
GeoDB maps IPs to their geological location based on MaxMinds GeoLite2 or GeoIP2 database.
func NewGeoDB ¶
NewGeoDB creates a new GeoDB for given license key. The download URL is optional and will be set to the default if empty. It must contain "LICENSE_KEY" for the license key.
func (*GeoDB) GetLocation ¶
GetLocation looks up the country code, subdivision (region), and city for given IP. If the IP is invalid it will return an empty string. The country code is returned in lowercase.
func (*GeoDB) UpdateFromFile ¶
UpdateFromFile updates GeoDB from given file instead of downloading the database.
Click to show internal directories.
Click to hide internal directories.