Documentation
¶
Index ¶
Constants ¶
const ( // FieldCity 城市 FieldCity = "city" // FieldContinent 大洲 FieldContinent = "continent" // FieldContinentCode 大洲代码 FieldContinentCode = "continent_code" // FieldCountry 国家 FieldCountry = "country" // FieldCountryISOCode 国家ISO代码 FieldCountryISOCode = "country_iso_code" // FieldCountryIsInEuropeanUnion 国家是否在欧盟 FieldCountryIsInEuropeanUnion = "country_is_in_european_union" // FieldAccuracyRadius 定位精度 FieldAccuracyRadius = "accuracy_radius" // FieldLatitude 纬度 FieldLatitude = "latitude" // FieldLongitude 经度 FieldLongitude = "longitude" // FieldMetroCode 城市代码 FieldMetroCode = "metro_code" // FieldTimeZone 时区 FieldTimeZone = "time_zone" // FieldPostalCode 邮政编码 FieldPostalCode = "postal_code" // FieldRegisteredCountry 注册国家 FieldRegisteredCountry = "registered_country" // FieldRegisteredCountryISOCode 注册国家ISO代码 FieldRegisteredCountryISOCode = "registered_country_iso_code" // FieldRegisteredCountryIsInEuropeanUnion 注册国家是否在欧盟 FieldRegisteredCountryIsInEuropeanUnion = "registered_country_is_in_european_union" // FieldRepresentedCountry 代表国家 FieldRepresentedCountry = "represented_country" // FieldRepresentedCountryISOCode 代表国家ISO代码 FieldRepresentedCountryISOCode = "represented_country_iso_code" // FieldRepresentedCountryIsInEuropeanUnion 代表国家是否在欧盟 FieldRepresentedCountryIsInEuropeanUnion = "represented_country_is_in_european_union" // FieldRepresentedCountryType 代表国家类型 FieldRepresentedCountryType = "represented_country_type" // FieldIsAnonymousProxy 是否匿名代理 FieldIsAnonymousProxy = "is_anonymous_proxy" // FieldIsSatelliteProvider 是否卫星提供商 FieldIsSatelliteProvider = "is_satellite_provider" // FieldAutonomousSystemNumber 自治系统号 FieldAutonomousSystemNumber = "autonomous_system_number" // FieldAutonomousSystemOrganization 自治系统组织 FieldAutonomousSystemOrganization = "autonomous_system_organization" )
Variables ¶
var ASNFullFields = []string{ FieldAutonomousSystemNumber, FieldAutonomousSystemOrganization, }
ASNFullFields ASN数据库全字段列表
var CityFullFields = []string{ FieldCity, FieldContinent, FieldContinentCode, FieldCountry, FieldCountryISOCode, FieldCountryIsInEuropeanUnion, FieldAccuracyRadius, FieldLatitude, FieldLongitude, FieldMetroCode, FieldTimeZone, FieldPostalCode, FieldRegisteredCountry, FieldRegisteredCountryISOCode, FieldRegisteredCountryIsInEuropeanUnion, FieldIsAnonymousProxy, FieldIsSatelliteProvider, }
CityFullFields 城市数据库全字段列表
var CommonFieldsMap = map[string]string{ model.Country: FieldCountry, model.City: FieldCity, model.Continent: FieldContinent, model.UTCOffset: FieldTimeZone, model.Latitude: FieldLatitude, model.Longitude: FieldLongitude, }
CommonFieldsMap 公共字段映射
var Lang = "zh-CN"
Functions ¶
This section is empty.
Types ¶
type ASN ¶ added in v0.1.4
type ASN struct { AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` }
The ASN struct corresponds to the data in the GeoLite2 ASN database.
type AnonymousIP ¶ added in v0.1.4
type AnonymousIP struct { IsAnonymous bool `maxminddb:"is_anonymous"` IsAnonymousVPN bool `maxminddb:"is_anonymous_vpn"` IsHostingProvider bool `maxminddb:"is_hosting_provider"` IsPublicProxy bool `maxminddb:"is_public_proxy"` IsResidentialProxy bool `maxminddb:"is_residential_proxy"` IsTorExitNode bool `maxminddb:"is_tor_exit_node"` }
The AnonymousIP struct corresponds to the data in the GeoIP2 Anonymous IP database.
type City ¶
type City struct { City struct { GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` } `maxminddb:"city"` Continent struct { Code string `maxminddb:"code"` GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` } `maxminddb:"continent"` Country struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"country"` Location struct { AccuracyRadius uint16 `maxminddb:"accuracy_radius"` Latitude float64 `maxminddb:"latitude"` Longitude float64 `maxminddb:"longitude"` MetroCode uint `maxminddb:"metro_code"` TimeZone string `maxminddb:"time_zone"` } `maxminddb:"location"` Postal struct { Code string `maxminddb:"code"` } `maxminddb:"postal"` RegisteredCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"registered_country"` RepresentedCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Type string `maxminddb:"type"` } `maxminddb:"represented_country"` Subdivisions []struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"subdivisions"` Traits struct { IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` } `maxminddb:"traits"` }
The City struct corresponds to the data in the GeoIP2/GeoLite2 City databases.
type ConnectionType ¶ added in v0.1.4
type ConnectionType struct {
ConnectionType string `maxminddb:"connection_type"`
}
The ConnectionType struct corresponds to the data in the GeoIP2 Connection-Type database.
type Country ¶ added in v0.1.4
type Country struct { Continent struct { Code string `maxminddb:"code"` GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` } `maxminddb:"continent"` Country struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"country"` RegisteredCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"registered_country"` RepresentedCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Type string `maxminddb:"type"` } `maxminddb:"represented_country"` Traits struct { IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` } `maxminddb:"traits"` }
The Country struct corresponds to the data in the GeoIP2/GeoLite2 Country databases.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
type Domain ¶ added in v0.1.4
type Domain struct {
Domain string `maxminddb:"domain"`
}
The Domain struct corresponds to the data in the GeoIP2 Domain database.
type Enterprise ¶ added in v0.1.4
type Enterprise struct { City struct { Confidence uint8 `maxminddb:"confidence"` GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` } `maxminddb:"city"` Continent struct { Code string `maxminddb:"code"` GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` } `maxminddb:"continent"` Country struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Confidence uint8 `maxminddb:"confidence"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` } `maxminddb:"country"` Location struct { AccuracyRadius uint16 `maxminddb:"accuracy_radius"` Latitude float64 `maxminddb:"latitude"` Longitude float64 `maxminddb:"longitude"` MetroCode uint `maxminddb:"metro_code"` TimeZone string `maxminddb:"time_zone"` } `maxminddb:"location"` Postal struct { Code string `maxminddb:"code"` Confidence uint8 `maxminddb:"confidence"` } `maxminddb:"postal"` RegisteredCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Confidence uint8 `maxminddb:"confidence"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` } `maxminddb:"registered_country"` RepresentedCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsInEuropeanUnion bool `maxminddb:"is_in_european_union"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Type string `maxminddb:"type"` } `maxminddb:"represented_country"` Subdivisions []struct { Confidence uint8 `maxminddb:"confidence"` GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` } `maxminddb:"subdivisions"` Traits struct { AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` ConnectionType string `maxminddb:"connection_type"` Domain string `maxminddb:"domain"` IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` IsLegitimateProxy bool `maxminddb:"is_legitimate_proxy"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` ISP string `maxminddb:"isp"` MobileCountryCode string `maxminddb:"mobile_country_code"` MobileNetworkCode string `maxminddb:"mobile_network_code"` Organization string `maxminddb:"organization"` StaticIPScore float64 `maxminddb:"static_ip_score"` UserType string `maxminddb:"user_type"` } `maxminddb:"traits"` }
The Enterprise struct corresponds to the data in the GeoIP2 Enterprise database.
type ISP ¶ added in v0.1.4
type ISP struct { AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` ISP string `maxminddb:"isp"` MobileCountryCode string `maxminddb:"mobile_country_code"` MobileNetworkCode string `maxminddb:"mobile_network_code"` Organization string `maxminddb:"organization"` }
The ISP struct corresponds to the data in the GeoIP2 ISP database.