rgip

command module
v0.0.0-...-9e16503 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2016 License: MIT Imports: 31 Imported by: 0

README

rigp

A restful geoip service.

How to build

  1. Install libGeoIP. With Homebrew, use the geoip formula. On Debian/Ubuntu, install libgeoip-dev.

  2. go get github.com/codahale/geoip

  3. In the base directory of the project: go get && go build

How to run

Make sure you have GeoLiteCity.dat or GeoIPCity.dat, GeoIPISP.dat and GeoIPNetSpeed.dat in your data directory.

  1. ./rgip -datadir /usr/local/share/GeoIP

  2. Endpoints will be available for /lookup/<ip> and /lookups/<ip>,<ip>,...

Example:

http://localhost:8080/lookup/16.0.0.0

{
  "ip": "16.0.0.0",
  "city": {
    "city": "Palo Alto",
    "country_code": "us",
    "latitude": 37.3762,
    "longitude": -122.1826,
    "region": "CA",
    "region_name": "California",
    "postal_code": "94304",
    "area_code": 650,
    "time_zone": "America/Los_Angeles"
  },
  "isp": "",
  "netspeed": "Unknown",
  "ufi": {
    "guessed_ufi": 0
  },
  "geohash": "9q9hesjk5h",
  "olc": "849V9RG8+FX"
}

For multiple IPs, use http://localhost:8080/lookups/16.0.0.0,18.0.0.0

Documentation

For documentation, check godoc.

Documentation

Overview

Command rgip is a restful geoip lookup service

Directories

Path Synopsis
Package geoip provides a thin wrapper around libGeoIP for looking up geographical information about IP addresses.
Package geoip provides a thin wrapper around libGeoIP for looking up geographical information about IP addresses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL