nodejs client init

This commit is contained in:
dongyado 2016-06-22 20:00:23 +08:00
parent 72ca42f54f
commit 0e498e27f8
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/**
* ip2region client for nodejs
*
* project: https://github.com/lionsoul2016/ip2region
*
* @author dongyado<dongyado@gmail.com>
* */
var ip2r = {};
ip2r.db_file = null;
exports.setDbFile = function(path)
{
ip2r.db_file = path;
}
exports.getDbFile = function(path)
{
return ip2r.db_file;
}
exports.binarySearch = function(ip)
{
return ip;
}
exports.btreeSearch = function(ip)
{
return ip;
}

View File

@ -0,0 +1,24 @@
{
"name": "ip2region",
"version": "0.0.1",
"description": "ip database ",
"main": "ip2region.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/lionsoul2016/ip2region"
},
"keywords": [
"ip2region",
"ip",
"region"
],
"author": "dongyado",
"license": "ISC",
"bugs": {
"url": "https://github.com/lionsoul2016/ip2region/issues"
},
"homepage": "https://github.com/lionsoul2016/ip2region"
}

10
binding/nodejs/test.js Normal file
View File

@ -0,0 +1,10 @@
/**
* test program
* */
var ip2r = require('./ip2region');
ip2r.setDbFile('./ip2region.db');
console.log(ip2r.getDbFile());
console.log(ip2r.binarySearch("12321231"));