Documentation ¶
Index ¶
Constants ¶
View Source
const AsnDB = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz"
AsnDB download link
View Source
const CityDB = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"
CityDB download link
Variables ¶
View Source
var DefaultClient = &Client{ DBLocationDir: "maxminddb", Timeout: time.Second * 15, MaxConnect: 0x64, }
DefaultClient ...
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { DBLocationDir string // DBLocationDir is used to store mmdb files MaxConnect int // max synchronously lookup Timeout time.Duration // lookup duration AsnDB *maxminddb.Reader CityDB *maxminddb.Reader // contains filtered or unexported fields }
Client ...
type DBMeta ¶
type DBMeta struct { Version string `json:"version"` IPVersion string `json:"ipVersion"` DatabaseType string `json:"type"` BuildEpoch time.Time `json:"buildEpoch"` }
DBMeta metadata
type Result ¶
type Result struct { Continent struct { Code string `maxminddb:"code" json:"code"` Names struct { ZhCN string `maxminddb:"zh-CN" json:"zh-cn"` En string `maxminddb:"en" json:"en"` } `maxminddb:"names" json:"names"` } `maxminddb:"continent" json:"continent"` Country struct { ISOCode string `maxminddb:"iso_code" json:"iso_code"` Names struct { ZhCN string `maxminddb:"zh-CN" json:"zh-cn"` En string `maxminddb:"en" json:"en"` } `maxminddb:"names" json:"names"` } `maxminddb:"country" json:"country"` City struct { Names struct { ZhCN string `maxminddb:"zh-CN" json:"zh-cn"` En string `maxminddb:"en" json:"en"` } `maxminddb:"names" json:"names"` } `maxminddb:"city" json:"city"` Subdivisions []struct { ISOCode string `maxminddb:"iso_code" json:"iso_code"` Names struct { ZhCN string `maxminddb:"zh-CN" json:"zh-cn"` En string `maxminddb:"en" json:"en"` } `maxminddb:"names" json:"names"` } `maxminddb:"subdivisions" json:"subdivisions"` Location struct { TimeZone string `maxminddb:"time_zone" json:"time_zone"` Latitude float32 `maxminddb:"latitude" json:"latitude"` Longitude float32 `maxminddb:"longitude" json:"longitude"` AccuracyRadius int `maxminddb:"accuracy_radius" json:"accuracy_radius"` } `maxminddb:"location" json:"location"` RegisteredCountry struct { ISOCode string `maxminddb:"iso_code" json:"iso_code"` Names struct { ZhCN string `maxminddb:"zh-CN" json:"zh-cn"` En string `maxminddb:"en" json:"en"` } `maxminddb:"names" json:"names"` } `maxminddb:"registered_country" json:"registered_country"` Organization string `maxminddb:"autonomous_system_organization" json:"organization"` }
Result of lookup
Click to show internal directories.
Click to hide internal directories.