kikinteractive/go-geoip-service

Name: go-geoip-service

Owner: Kik Interactive

Description: A Go (golang) HTTP service which will tell you the country associated with a given IP.

Forked from: dseevr/go-geoip-service

Created: 2017-06-18 12:24:43.0

Updated: 2017-06-18 12:24:45.0

Pushed: 2017-07-09 20:16:06.0

Homepage:

Size: 604

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status goreportcard

Go GeoIP Service

A Go (golang) HTTP service which will tell you the country associated with a given IP.

Usage

Go get:

et github.com/dseevr/go-geoip-service
ATH/bin/go-geoip-service --db-path=/mm.db --port=1234

Build it yourself:

clone git@github.com:dseevr/go-geoip-service.git
o-geoip-service

-geoip-service --db-path=/mm.db --port=1234

Run from Docker:

er run --rm -it \
 1234:1234 \
 /foo/bar/GeoLite2-Country.mmdb:/mm.db:ro \
llrobinson/go-geoip-service --db-path=/mm.db --port=1234
Looking up an IP
 -s 'http://localhost:12345/lookup?ip=109.111.96.0'

Response:


ountry_code": "AD",
ountry": "Andorra",
egion_code": "07",
ity": "Andorra la Vella",
ontinent_code": "EU",
ontinent": "Europe",
ocation": {
"lat": 42.5,
"lon": 1.5167000000000002


Prerequisites

You will need a GeoLite2 database from MaxMind. Specify it with the --db-path option.

You can get a database here: https://dev.maxmind.com/geoip/geoip2/geolite2/

Running the tests

You will need to have a MaxMind database in the base folder called test.db.

Then just run make test!

License

BSD


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.