Skip to content
Zerf edited this page Jun 8, 2016 · 2 revisions

gm_geoip wiki

Welcome to the gm_geoip wiki. Here you will find documentation for this module. For installation instructions and the like, see README.md in the repository. For example usage of this module, scroll down.

geoip library

geoip.OpenDB(string path)

Opens an MMDB file and returns a GeoIPDB utilizing it.

GeoIPDB class

GeoIPDB:GetIPInfo(string ipAddr)

Returns a table of GeoIP data for the given IP address.

Example

First download the GeoLite2 City database and place it in your data folder, then run:

> require("geoip")
> TestDB = geoip.OpenDB("data/GeoLite2-City.mmdb")
> PrintTable(TestDB:GetIPInfo("8.8.8.8"))
accuracy_radius	=	937
city	=	Mountain View
continent	=	NA
country	=	US
latitude	=	37.386
longitude	=	-122.0838
state	=	CA
time_zone	=	America/Los_Angeles
Clone this wiki locally