Documentation
¶
Index ¶
Constants ¶
const ( FileASN4 = "ip2asn-v4.tsv.gz" FileASN6 = "ip2asn-v6.tsv.gz" FileASNCombined = "ip2asn-combined.tsv.gz" FileCountry4 = "ip2country-v4.tsv.gz" FileCountry6 = "ip2country-v6.tsv.gz" )
Supported source filenames from iptoasn.com.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ASNRecord ¶
type ASNRecord struct {
StartIP netip.Addr
EndIP netip.Addr
ASN uint32
Country string
Organization string
}
ASNRecord represents a parsed line from ip2asn files.
func ParseASNRecords ¶
ParseASNRecords parses ip2asn TSV data from a reader. Format: start_ip end_ip asn country description Records with ASN 0 ("Not routed") are included so users can distinguish between "IP not in database" and "IP known but not routed".
type Config ¶
type Config struct {
OutputFile string
DataType DataType
IPVersion IPVersion
SourceFile string // Local TSV/TSV.gz file
Download bool // If true, download from iptoasn.com
}
Config holds the build configuration.
func (Config) SourceURLs ¶
SourceURLs returns the URLs to download based on configuration.
type CountryRecord ¶
CountryRecord represents a parsed line from ip2country files.
func ParseCountryRecords ¶
func ParseCountryRecords(r io.Reader) ([]CountryRecord, error)
ParseCountryRecords parses ip2country TSV data from a reader. Format: start_ip end_ip country Records with country "None" are included so users can distinguish between "IP not in database" and "IP known but no country assigned".