t e l i z e
_______________________
______\ /_______
\\ \\ ___ // /
__ \ ____ \ __ / \ _____/\ / ____
___/ \____/ _//____/ \___\___/___\__ /__/ _//____
\\__ ____ __/ __ __ ____ ____ __/ __///
/ \_ |/ \_ / \/ /_/ |/ \_
\\\ ___/\___ /____/\_______/\ ___/\___ /
<0(--- \__/ -h7- \______/ \ . \__/ ---- \______/ --(0>
\ .\ /. .
\ .\ // /
\______\\ //______/
Y
Telize is a REST API built on Nginx and Lua allowing to get a visitor IP address and to query location information from any IP address. It outputs JSON-encoded IP geolocation data, and supports both JSON and JSONP.
Telize requires Nginx compiled with the following modules :
- GeoIP (Optional HTTP modules : --with-http_geoip_module)
- HttpRealipModule (Optional HTTP module : --with-http_realip_module)
- HttpEchoModule (Third party module (ngx_echo) : http://wiki.nginx.org/HttpEchoModule)
- HttpLuaModule (Third party module (ngx_lua) : http://wiki.nginx.org/HttpLuaModule)
If you are using Debian stable, the nginx-extras
package have these
modules compiled-in.
Telize requires the following Lua module :
- Lua CJSON
Installing via LuaRocks :
luarocks install lua-cjson
Telize requires the free GeoLite databases : http://dev.maxmind.com/geoip/legacy/geolite/
mkdir -p /usr/share/GeoIP
cd /usr/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
gunzip *gz
mkdir -p /usr/share/GeoIP
cd /usr/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz
wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz
gunzip *gz
Copy timezone.conf
in the Nginx configuration files directory.
Edit nginx.conf
to include timezone.conf
and to add directives specifying
the path to the GeoIP database files, within the http block.
http {
...
include /etc/nginx/timezone.conf;
geoip_country /usr/share/GeoIP/GeoIP.dat;
geoip_city /usr/share/GeoIP/GeoLiteCity.dat;
geoip_org /usr/share/GeoIP/GeoIPASNum.dat;
}
http {
...
include /etc/nginx/timezone.conf;
geoip_country /usr/share/GeoIP/GeoIPv6.dat;
geoip_city /usr/share/GeoIP/GeoLiteCityv6.dat;
geoip_org /usr/share/GeoIP/GeoIPASNumv6.dat;
}
Then deploy the API configuration file telize
to the appropriate location on
your system, and reload Nginx configuration.
For complete API documentation and JavaScript API usage examples, please check the project site : http://www.telize.com
- Example : http://www.telize.com/ip
- Example (JSON) : http://www.telize.com/jsonip
- Example (JSONP) : http://www.telize.com/jsonip?callback=getip
Calling the API endpoint without any parameter will return the visitor IP address :
- Example (JSON) : http://www.telize.com/geoip
- Example (JSONP) : http://www.telize.com/geoip?callback=getgeoip
Appending an IP address as parameter will return location information for this IP address :
- Example (JSON) : http://www.telize.com/geoip/46.19.37.108
- Example (JSONP) : http://www.telize.com/geoip/46.19.37.108?callback=getgeoip
Telize is released under the BSD 3-Clause license. See LICENSE
file
for details.
Telize is developed by Frederic Cambus
- Site : http://www.cambus.net
- Twitter: http://twitter.com/fcambus
Project Homepage : http://www.telize.com
Latest tarball release : http://www.statdns.com/telize/telize-1.01.tar.gz
GitHub : https://github.com/fcambus/telize