Skip to content

Transform an IP into a string of the form "City, Country"

Notifications You must be signed in to change notification settings

gmou3/ip-to-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ip-to-location

A tool that transforms an IP into a string of the form City, Country.

It works by scraping a free mmdb database from db-ip and performing IP lookups using libmaxminddb.

The database file is automatically kept up-to-date with the upstream monthly updates.

The compressed database file is decompressed using libdeflate.

Build

Clone the repo with its submodules:

git clone https://github.com/gmou3/ip-to-location --recurse-submodules
cd ip-to-location/

Then, to build, run:

cmake -B build
cd build/
cmake --build .

Usage

Run the compiled ip-to-location executable with an IP address as an argument. For example, to get the location of your own IP, run

./ip-to-location $(curl -s ifconfig.me)

Third party libraries used

  1. libdeflate
  2. libmaxminddb

About

Transform an IP into a string of the form "City, Country"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published