Skip to content

get geolocation information for IPv4 and IPv6

Notifications You must be signed in to change notification settings

jpantunes/geoIP

Repository files navigation

geoIP

get geolocation information for IPv4 and IPv6 addresses using Maxmind's free database (https://dev.maxmind.com/geoip/geoip2/geoip2-city-country-csv-databases/)

Stack

  • docker
  • postgres
  • nodejs
  • express
  • swagger

Running the app

in docker

npm run start:docker

in local machine

npm start OR swagger project start

Usage

curl http://localhost:10010/location/81.84.143.19

output:

{"network":"81.84.140.0/22","city_name":"Torre da Marinha","country_name":"Portugal","country_iso_code":"PT"}

swagger doc

curl http://127.0.0.1:10010/swagger/

generated by running swagger-codegen generate -i swagger.yaml -l swagger from inside the api/swagger/ folder

Gotcha's

the Maxmind CSV files need to be placed on db_load and the createDB.sql script must be run manually to seed the database.

if the db_data folder exists, docker will ignore /docker-entrypoint-initdb.d scripts. remove db_data to create schema and seed the db with csv data

TODOs

[100%] automatically create schema and seed the db with csv data on db initialisation [] update the GeoLite2 csv files on request

About

get geolocation information for IPv4 and IPv6

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published