Skip to content

Commit

Permalink
Added temporary README.
Browse files Browse the repository at this point in the history
  • Loading branch information
strange committed Feb 10, 2010
1 parent e52b6cf commit 28e524f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Naive wrapper around libGeoIP.

1) Install libGeoIP shared libraries.
2) Download GeoLiceCity.dat and place in `/usr/local/share/GeoIP`
2) Run `node-waf configure build`
3) Test `node examples/lookup.js`

(should work out of the box if everything is installed into `/usr/local` --
otherwise tweak example to match your placement of the Geo* database)
4 changes: 3 additions & 1 deletion examples/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ con.addListener('connected', function () {
sys.puts(attr + ' : ' + result[attr]);
}
});
con.query('216.236.135.152');
var ip = '216.236.135.152';
sys.puts('Looking up ip: ' + ip + '...\n');
con.query(ip);
});
con.connect('/usr/local/share/GeoIP/GeoLiteCity.dat');
4 changes: 3 additions & 1 deletion examples/lookup2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ var sys = require('sys'),

con = new geoip.Connection('/usr/local/share/GeoIP/GeoLiteCity.dat');

con.query('216.236.135.152').addCallback(function (result) {
var ip = '216.236.135.152';
sys.puts('Looking up ip: ' + ip + '...\n');
con.query(ip).addCallback(function (result) {
for (var attr in result) {
sys.puts(attr + ' : ' + result[attr]);
}
Expand Down

0 comments on commit 28e524f

Please sign in to comment.