All Projects → ankushs92 → Java-DB-IP

ankushs92 / Java-DB-IP

Licence: MIT license
A Java wrapper for DB-IP free city database

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to Java-DB-IP

Geolocator-2
Learn how to find and work with locations in Django, the Yelp API, and Google Maps api.
Stars: ✭ 24 (-17.24%)
Mutual labels:  geolocation
IP2Location-PHP-Module
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
Stars: ✭ 154 (+431.03%)
Mutual labels:  geolocation
locus
MMDB reader for geolocation and ASN lookup of IP addresses
Stars: ✭ 93 (+220.69%)
Mutual labels:  geolocation
CLAVIN-NERD
Stanford NLP Implementation of the CLAVIN LocationTagger
Stars: ✭ 22 (-24.14%)
Mutual labels:  geolocation
osx-location
🌎 Utility for polling OS X Location Services for current geographic coordinates. Works on Lion or better.
Stars: ✭ 31 (+6.9%)
Mutual labels:  geolocation
Mr.Holmes
🔍 A Complete Osint Tool
Stars: ✭ 307 (+958.62%)
Mutual labels:  geolocation
CLAVIN-rest
A Spring Boot microservice that serves the CLAVIN (https://github.com/novetta/CLAVIN) library for geo rectifying locations mentioned in text.
Stars: ✭ 16 (-44.83%)
Mutual labels:  geolocation
Avenue-GPX-Viewer
A simple and easy GPX viewer for macOS.
Stars: ✭ 42 (+44.83%)
Mutual labels:  geolocation
xuber2
An example ridesharing app built with Elixir
Stars: ✭ 24 (-17.24%)
Mutual labels:  geolocation
dating-app-concept-flutter
Dating App UI concept made to showcase Flutter in SheCodes hackathon
Stars: ✭ 53 (+82.76%)
Mutual labels:  geolocation
orange3-geo
🍊 🌍 Orange add-on for dealing with geography and geo-location
Stars: ✭ 22 (-24.14%)
Mutual labels:  geolocation
ip2location-cakephp
IP2Location CakePHP plugin enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, IP address type and IAB advertising category from IP address using IP2Location database.
Stars: ✭ 17 (-41.38%)
Mutual labels:  geolocation
php
Official PHP client library for the ipdata API
Stars: ✭ 16 (-44.83%)
Mutual labels:  geolocation
ip2location-iata-icao
This list contains the airport codes of IATA airport code and ICAO airport code together with country code and region name supported in IP2Location geolocation database.
Stars: ✭ 39 (+34.48%)
Mutual labels:  geolocation
LabsPT1 bkwds
bkwds is an app that helps adventurers track their trips and travel safely
Stars: ✭ 40 (+37.93%)
Mutual labels:  geolocation
trackanimation
Track Animation is a Python 2 and 3 library that provides an easy and user-adjustable way of creating visualizations from GPS data.
Stars: ✭ 74 (+155.17%)
Mutual labels:  geolocation
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (-27.59%)
Mutual labels:  geolocation
crisis-news-mapper
日本の災害関連ニュースをTwitterから収集して地図上にマッピングするFirebaseプロジェクト crisis.yuiseki.net
Stars: ✭ 13 (-55.17%)
Mutual labels:  geolocation
photos2geojson
html map gallery from photos
Stars: ✭ 39 (+34.48%)
Mutual labels:  geolocation
IP2Country
Ip to country mapping
Stars: ✭ 39 (+34.48%)
Mutual labels:  geolocation

Java DB-IP

A simple to use Java library for the freely available DB-IP IP address to city dataset.

Requires Java 8

The entire dataset is loaded into a TreeMap . Make sure that you have about 2 GB of Heap space available to load it.

Links

With maven :

<dependency>
	  <groupId>in.ankushs</groupId>
	  <artifactId>Java-DB-IP</artifactId>
	  <version>2.0</version>
</dependency>

Or gradle:

compile('in.ankushs:Java-DB-IP:2.0')

Instructions

In order to get geographical information for an ip address, just pass the dbip-city-latest.csv.gz as a File object to DbIpClient as follows:

final File gzipFile = new File(PATH_TO_dbip-city-latest.csv.gz);
final DbIpClient client = new DbIpClient(gzipFile);

Once the data is loaded from the file into memory, any subsequent invocation of the above code would not load the data .

Next, just fetch the data for a ip ,like so :

final DbIpClient client = new DbIpClient(gzip);
final GeoEntity geoEntity = client.lookup("31.45.127.255");
final String city = geoEntity.getCity();
final String country = geoEntity.getCountry();
final String province = geoEntity.getProvince();
final String countryCode = geoEntity.getCountryCode();

System.out.println("city : " + city);
System.out.println("province : " + province);
System.out.println("country : " + country);
System.out.println("country code : " + countryCode);

This prints :

city : New Delhi
province : Delhi
country : India
country code : IN

For IPV6, do the same :

final DbIpClient client = new DbIpClient(gzip);
final String ipv6 = "2c0f:f468:ffff:ffff:ffff:ffff:ffff:ffff";
final GeoEntity geoEntity = client.lookup(ipv6);

That's pretty much it.

Performance

The lookup is stunningly fast. Since the entire data is cached the JVM, you can expect each lookup to take around 0.1 ms

Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].