ip2location-d 8.4.0
IP2Location D Library
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
IP2Location D Library
This D library provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type and IAB category from IP address by using IP2Location database. This library uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type and IAB category as values. It supports both IP address in IPv4 and IPv6.
This library can be used in many types of projects such as:
- select the geographically closest mirror
- analyze your web server logs to determine the countries of your visitors
- credit card fraud detection
- software export controls
- display native language and currency
- prevent password sharing and abuse of service
- geotargeting in advertisement
The database will be updated in monthly basis for the greater accuracy. Free LITE databases are available at https://lite.ip2location.com/ upon registration.
The paid databases are available at https://www.ip2location.com under Premium subscription package.
Installation
To install this library using dub:
"dependencies": {
"ip2location-d": "~master"
}
Example
import std.stdio;
import ip2location : ip2location;
int main() {
string db = "./IPV6-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-ADDRESSTYPE-CATEGORY.BIN";
ip2location ip2loc = new ip2location(db);
auto results = ip2loc.get_all("8.8.8.8");
writeln("country_short: ", results.country_short);
writeln("country_long: ", results.country_long);
writeln("region: ", results.region);
writeln("city: ", results.city);
writeln("isp: ", results.isp);
writefln("latitude: %f", results.latitude);
writefln("longitude: %f", results.longitude);
writeln("domain: ", results.domain);
writeln("zipcode: ", results.zipcode);
writeln("timezone: ", results.timezone);
writeln("netspeed: ", results.netspeed);
writeln("iddcode: ", results.iddcode);
writeln("areacode: ", results.areacode);
writeln("weatherstationcode: ", results.weatherstationcode);
writeln("weatherstationname: ", results.weatherstationname);
writeln("mcc: ", results.mcc);
writeln("mnc: ", results.mnc);
writeln("mobilebrand: ", results.mobilebrand);
writefln("elevation: %f", results.elevation);
writeln("usagetype: ", results.usagetype);
writeln("addresstype: ", results.addresstype);
writeln("category: ", results.category);
writeln("API Version: ", ip2loc.api_version());
ip2loc.close();
return 0;
}
Dependencies
The complete database is available at https://www.ip2location.com under subscription package.
IPv4 BIN vs IPv6 BIN
Use the IPv4 BIN file if you just need to query IPv4 addresses.
Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.
Copyright
Copyright (C) 2021 by IP2Location.com, [email protected]
- Registered by IP2Location
- 8.4.0 released 3 years ago
- ip2location/ip2location-d
- www.ip2location.com/development-libraries/ip2location/d
- MIT
- Copyright © 2021, IP2Location
- Authors:
- Dependencies:
- none
- Versions:
-
8.7.0 2023-Apr-04 8.6.0 2022-Jun-23 8.5.0 2021-Nov-18 8.4.1 2021-Jul-05 8.4.0 2021-Jun-17 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
72 downloads total
-
- Score:
- 1.2
- Short URL:
- ip2location-d.dub.pm