Skip to content

GoipLookup uses the GeoLite2-Country database to find the Country of an IP address or hostname

License

Notifications You must be signed in to change notification settings

Inaciomcr/goiplookup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoipLookup - geoiplookup for GeoLite2 written in Go

GoipLookup is a geoiplookup replacement for the free GeoLite2-Country, written in Go.

It currently only supports the free GeoLite2-Country database, and there is no planned support for the other types.

Features

  • Drop-in replacement for the now defunt geoiplookup utility, simply rename it
  • Works with the current Maxmind database format (mmdd)
  • IPv4, IPv6 and fully qualified domain name (FQDN) support
  • Options to return just the country iso (NZ) or country name (New Zealand), rather than the full GeoIP Country Edition: NZ, New Zealand
  • Built-in database update support
  • Built-in self updater (if new release is available)

Installing

Multiple OS/Architecture binaries are supplied with releases. Extract the binary, make it executable, and move it to a location such as /usr/local/bin.

If you wish to replace an existing defunct implementation of geoiplookup, then simply name the file geoiplookup.

Updating

GoipLookup comes with a built-in self-updater:

goiplookup self-update

Compiling from source

You must have golang installed. There is one external library required (oschwald/geoip2-golang) which is downloaded automatically when you run make:

git clone [email protected]:axllent/goiplookup.git
cd goiplookup
make

Basic usage

Usage: goiplookup [-i] [-c] [-d <database directory>] <ipaddress|hostname|db-update|self-update>

Options:
  -V	show version number
  -c	return country name
  -d string
    	database directory or file (default "/usr/share/GeoIP")
  -h	show help
  -i	return country iso code
  -v	verbose/debug output

Examples:
goiplookup 8.8.8.8			Return the country ISO code and name
goiplookup -d ~/GeoIP 8.8.8.8		Use a different database directory
goiplookup -i 8.8.8.8			Return just the country ISO code
goiplookup -c 8.8.8.8			Return just the country name
goiplookup db-update			Update the GeoLite2-Country database (do not run more than once a month)
goiplookup self-update			Update the GoIpLookup binary with the latest release

About

GoipLookup uses the GeoLite2-Country database to find the Country of an IP address or hostname

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.9%
  • Makefile 2.1%