Documentation ¶
Overview ¶
Only files including IPv4, IPv6, and Location (in english) will be read and parsed into lists.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEqualIPNodes ¶
Returns nil if two nodes are equal Used by the search package
Types ¶
type GeoDataset ¶
type GeoDataset struct { IP4Nodes []IPNode // The IPNode list containing IP4Nodes IP6Nodes []IPNode // The IPNode list containing IP6Nodes LocationNodes []LocationNode // The location nodes corresponding to the IPNodes }
The GeoDataset struct bundles all the data needed to search and find data into one common structure
func LoadGeoLite2 ¶
func LoadGeoLite2(zip *zip.Reader) (*GeoDataset, error)
type IPNode ¶
type IPNode struct { IPAddressLow net.IP IPAddressHigh net.IP LocationIndex int // Index to slice of locations PostalCode string Latitude float64 Longitude float64 }
IPNode defines IPv4 and IPv6 databases
type LocationNode ¶
type LocationNode struct { GeonameID int ContinentCode string CountryCode string CountryName string RegionCode string RegionName string MetroCode int64 CityName string }
locationNode defines Location databases
func LoadLocListGLite1 ¶
Create Location list, map, and Glite1HelpNode for GLite1 databases GLiteHelpNode contains information to help populate fields in IPNode
func LoadLocListGLite2 ¶
Create Location list for GLite2 databases TODO This code is a bit fragile. Should probably parse the header and use that to guide the parsing of the rows.
Click to show internal directories.
Click to hide internal directories.