Documentation
¶
Overview ¶
Package ip2location implements downloading and parsing of ip2location databases.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ASNRecord ¶
ASNRecord ip_from INT (10)† / DECIMAL (39,0)†† First IP address show netblock. ip_to INT (10)† / DECIMAL (39,0)†† Last IP address show netblock. cidr VARCHAR(43) IP address range in CIDR. asn INT(10) Autonomous system number (ASN). as VARCHAR(256) Autonomous system (AS) name.
type ASNRecords ¶ added in v0.1.8
type ASNRecords []ASNRecord
func (ASNRecords) Hosts ¶ added in v0.1.8
func (r ASNRecords) Hosts() uint32
type BlockListData ¶
type BlockListData struct { ASN4 []ASNRecord ASN6 []ASNRecord Locations4 []LocationRecord Locations6 []LocationRecord Proxies []ProxyRecord }
func Read ¶
func Read(root string) (*BlockListData, error)
type LatLong ¶
type Location ¶
type Location struct { ISOCode string LatLong LatLong // Autonomous system number (ASN) ASN uint64 // Autonomous system (AS) name AS string }
Location provides a container and some helper functions for location data
type LocationRecord ¶
type LocationRecord struct { IPFrom *net.IP IPTo *net.IP CountryCode string CountryName string RegionName string CityName string LatLong LatLong }
LocationRecord "16781312","16785407","JP","Japan","Tokyo","Tokyo","35.689506","139.691700" ip_from INT (10)† / DECIMAL (39,0)†† First IP address show netblock. ip_to INT (10)† / DECIMAL (39,0)†† Last IP address show netblock. country_code CHAR(2) Two-character country code based on ISO 3166. country_name VARCHAR(64) Country name based on ISO 3166. region_name VARCHAR(128) Region or state name. city_name VARCHAR(128) City name. latitude DOUBLE City latitude. Default to capital city latitude if city is unknown. longitude DOUBLE City longitude. Default to capital city longitude if city is unknown.
type ProxyRecord ¶
type ProxyRecord struct { IPFrom *net.IP IPTo *net.IP ProxyType ProxyType CountryCode string CountryName string RegionName string CityName string ISP string Domain string UsageType UsageType ASN int64 AS string LastSeen time.Time Threat ThreatType }
ProxyRecord ip_from INT (10)† / DECIMAL (39,0)†† First IP address show netblock. ip_to INT (10)† / DECIMAL (39,0)†† Last IP address show netblock. proxy_type VARCHAR(3) Type of proxy country_code CHAR(2) Two-character country code based on ISO 3166. country_name VARCHAR(64) Country name based on ISO 3166. region_name VARCHAR(128) Region or state name. city_name VARCHAR(128) City name. isp VARCHAR(256) Internet Service Provider or company's name. domain VARCHAR(128) Internet domain name associated with IP address range. usage_type VARCHAR(11) Usage type classification of ISP or company.
(COM) Commercial (ORG) Organization (GOV) Government (MIL) Military (EDU) University/College/School (LIB) Library (CDN) Content Delivery Network (ISP) Fixed Line ISP (MOB) Mobile ISP (DCH) Data Center/Web Hosting/Transit (SES) Search Engine Spider (RSV) Reserved
asn INT(10) Autonomous system number (ASN). as VARCHAR(256) Autonomous system (AS) name. last_seen INT(10) Proxy last seen in days. threat VARCHAR(128) Security threat reported.
type ThreatType ¶ added in v0.1.8
type ThreatType string
const ( ThreatUnknown ThreatType = "-" ThreatSpam ThreatType = "SPAM" ThreatBotnet ThreatType = "BOTNET" ThreatScanner ThreatType = "SCANNER" ThreatSpamBotnet ThreatType = "SPAM/BOTNET" ThreatSpamScanner ThreatType = "SPAM/SCANNER" ThreatSpamScannerBotnet ThreatType = "SPAM/SCANNER/BOTNET" )
type UsageType ¶ added in v0.1.8
type UsageType string
const ( UsageContentDeliveryNetwork UsageType = "CDN" UsageISPFixedMobile UsageType = "ISP/MOB" UsageCommercial UsageType = "COM" UsageISPMobile UsageType = "MOB" UsageLibrary UsageType = "LIB" UsageDataCenter UsageType = "DCH" UsageMilitary UsageType = "MIL" UsageGovernment UsageType = "GOV" UsageISPFixed UsageType = "ISP" UsageOrganization UsageType = "ORG" UsageEducation UsageType = "EDU" )