-
-
Notifications
You must be signed in to change notification settings - Fork 7
IP to country databases
Rob Janssen edited this page Oct 22, 2019
·
12 revisions
Data source: DbIpCSVFileSource
Example:
var resolver = new IP2CountryResolver(
new DbIpCSVFileSource(@"D:\files\dbip-country-lite-2019-10.csv.gz")
);
Data source: IP2IQCSVFileSource
Example:
var resolver = new IP2CountryResolver(
new IP2IQCSVFileSource(@"D:\files\ip2-cc.csv.gz")
);
Data source: IP2LocationFileSource
- https://lite.ip2location.com/download?db=db1&type=csv&version=4
- https://lite.ip2location.com/download?db=db3&type=csv&version=4
- https://lite.ip2location.com/download?db=db5&type=csv&version=4
- https://lite.ip2location.com/download?db=db9&type=csv&version=4
- https://lite.ip2location.com/download?db=db11&type=csv&version=4
- https://lite.ip2location.com/download?db=db1&type=csv&version=6
- https://lite.ip2location.com/download?db=db3&type=csv&version=6
- https://lite.ip2location.com/download?db=db5&type=csv&version=6
- https://lite.ip2location.com/download?db=db9&type=csv&version=6
- https://lite.ip2location.com/download?db=db11&type=csv&version=6
See IP2Location LITE Support for more information. You'll need an account to download these files.
Example:
var resolver = new IP2CountryResolver(
new IP2LocationFileSource(@"D:\files\IP2LOCATION-LITE-DB11.CSV")
);
Data source: LudostCSVFileSource
Example:
var resolver = new IP2CountryResolver(
new LudostCSVFileSource(@"D:\files\country.db.gz")
);
Data source: IpToAsnCSVFileSource
var resolver = new IP2CountryResolver(new IIP2CountryDataSource[] {
new IpToAsnCSVFileSource(@"D:\files\ip2country-v4.tsv.gz"),
new IpToAsnCSVFileSource(@"D:\files\ip2country-v6.tsv.gz")
});
Data source: MarkusGoCSVFileSource
Example:
var resolver = new IP2CountryResolver(
new MarkusGoCSVFileSource(@"D:\files\ip2country.zip")
);
Data source: MaxMindGeoLiteIPFileSource
- https://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip
- https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip
- https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip
Example:
var resolver = new IP2CountryResolver(
// City level file
new MaxMindGeoLiteFileSource(@"D:\files\GeoLite2-City-CSV_20190305.zip")
);
// OR:
var resolver = new IP2CountryResolver(
// Country level file
new MaxMindGeoLiteFileSource(@"D:\files\GeoLite2-Country-CSV_20190305.zip")
);
// OR:
var resolver = new IP2CountryResolver(
// ASN file (doesn't contain country info)
new MaxMindGeoLiteFileSource(@"D:\files\GeoLite2-ASN-CSV_20190305.zip")
);
Note that the constructor allows you to specify your preferred language (as long as it's included in the files obviously) and wether you want to read only IPv4 or IPv6 data or both.
Data source: RegistryCSVFileSource
- http://ftp.ripe.net/ripe/stats/delegated-ripencc-extended-latest
- http://ftp.apnic.net/pub/stats/apnic/delegated-apnic-extended-latest
- http://ftp.arin.net/pub/stats/arin/delegated-arin-extended-latest
- http://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest
- http://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-extended-latest
Example:
var resolver = new IP2CountryResolver(new IIP2CountryDataSource[] {
new RegistryCSVFileSource(@"D:\files\delegated-ripencc-extended-latest"),
new RegistryCSVFileSource(@"D:\files\delegated-apnic-extended-latest"),
new RegistryCSVFileSource(@"D:\files\delegated-arin-extended-latest"),
new RegistryCSVFileSource(@"D:\files\delegated-lacnic-extended-latest"),
new RegistryCSVFileSource(@"D:\files\delegated-afrinic-extended-latest")
});
Data source: WebNet77IPv4CSVFileSource
Data source: WebNet77IPv6CSVFileSource
Example:
var resolver = new IP2CountryResolver(new IIP2CountryDataSource[] {
new WebNet77IPv4CSVFileSource(@"D:\files\IpToCountry.csv.gz"),
new WebNet77IPv6CSVFileSource(@"D:\files\IpToCountry.6R.csv.gz")
});