Skip to content

Commit

Permalink
added v0.1.1 changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kuno committed Nov 27, 2010
1 parent 0b748d7 commit d9915cb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
7 changes: 7 additions & 0 deletions Changelog
@@ -0,0 +1,7 @@
v0.1.0, 2010-11-25
1, Initial release;

v0.1.1, 2010-11-27:
1, Removed GeoIP.dat, due to licence(or money) problem.
2, renamed city property to City, renamed country property to Country.
3, Allow close method to set all properties of an exsiting obj to undefined.
17 changes: 10 additions & 7 deletions README.md
Expand Up @@ -22,33 +22,36 @@ There are two free versions data among with some commercial versions.

* Open the country data file

var country_data = geoip.open('/path/to/GeoIP.dat');
var data = geoip.open('/path/to/GeoIP.dat');

* Synchronous methods, network independence.

geoip.country.code_by_addr(country_data, '8.8.8.8'); // prints 'US'
geoip.Country.code_by_addr(data, '8.8.8.8'); // prints 'US'

geoip.country.name_by_addr(country_data, '8.8.8.8'); // prints 'United States'
geoip.Country.name_by_addr(data, '8.8.8.8'); // prints 'United States'

* Asynchronous methods, depends on node's async-style dns module.

geoip.country.code_by_domain(data, 'www.google.com', function(err, code) {
geoip.Country.code_by_domain(data, 'www.google.com', function(err, code) {
if (err) {throw err;}
console.log(code); // prints 'US'
});

geoip.country.name_by_domain(data, 'www.google.com', function(err, name) {
geoip.Country.name_by_domain(data, 'www.google.com', function(err, name) {
if (err) {throw err;}
console.log(name); // prints 'United States'
});
* set the all properties of an exsiting data object to undefined.
geoip.close(data);

####City Information

* Open the GeoLiteCity.dat file first.

var city_data = geoip.open('/path/to/GeoLiteCity.dat');
var data = geoip.open('/path/to/GeoLiteCity.dat');

geoip.City.record_by_addr(data, '8.8.8.8'); // You will get something like this:

geoip.city.record_by_addr(city_data, '8.8.8.8'); // You will get something like this:
//{
//country_code: 'US',
//country_code3: 'USA',
Expand Down
16 changes: 9 additions & 7 deletions sample/sample.js
Expand Up @@ -7,22 +7,24 @@ var geoip = require('geoip');
* you need download GeoIP.dat file first.
* wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
*/
var country_data = geoip.open('/path/to/GeoIP.dat');
var data = geoip.open('/path/to/GeoIP.dat');

// Synchronous methods, network independence.
geoip.country.code_by_addr(country_data, '8.8.8.8'); // prints 'US'
geoip.country.name_by_addr(country_data, '8.8.8.8'); // prints 'United States'
geoip.Country.code_by_addr(data, '8.8.8.8'); // prints 'US'
geoip.Country.name_by_addr(data, '8.8.8.8'); // prints 'United States'

// Asynchronous methods, depends on node's async-style dns module.
geoip.country.code_by_domain(data, 'www.google.com', function(err, code) {
geoip.Country.code_by_domain(data, 'www.google.com', function(err, code) {
if (err) {throw err;}
console.log(code); // prints 'US'
});
geoip.country.name_by_domain(data, 'www.google.com', function(err, name) {
geoip.Country.name_by_domain(data, 'www.google.com', function(err, name) {
if (err) {throw err;}
console.log(name); // prints 'United States'
});

// Set the all properties of an existing data object to undefined
geoip.close(data);
/*
* City geo infomation
*
Expand All @@ -31,9 +33,9 @@ geoip.country.name_by_domain(data, 'www.google.com', function(err, name) {
* wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
*/

var city_data = geoip.open('/path/to/GeoLiteCity.dat');
var data = geoip.open('/path/to/GeoLiteCity.dat');

geoip.city.record_by_addr(city_data, '8.8.8.8'); // output this;
geoip.City.record_by_addr(data, '8.8.8.8'); // output this;
//{
//country_code: 'US',
//country_code3: 'USA',
Expand Down

0 comments on commit d9915cb

Please sign in to comment.