Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geoip-lite

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geoip-lite - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

9

lib/converter.js

@@ -30,5 +30,5 @@ var fs = require('fs');

for(i=0; i<sip.length; i++)
b.writeUInt32(sip[i], i*4, 'big');
b.writeUInt32(sip[i], i*4, true);
for(i=0; i<eip.length; i++)
b.writeUInt32(eip[i], 16+i*4, 'big');
b.writeUInt32(eip[i], 16+i*4, true);
}

@@ -43,4 +43,5 @@ else {

b = new Buffer(bsz);
b.writeUInt32(sip, 0, 'big');
b.writeUInt32(eip, 4, 'big');
b.fill(0);
b.writeUInt32(sip, 0, true);
b.writeUInt32(eip, 4, true);
}

@@ -47,0 +48,0 @@

@@ -5,2 +5,40 @@ var fs = require('fs'),

// First we have to define readUInt32 correctly based on the node version in use
// Our fault for using unstable APIs
var readUInt32;
if(process.version.match(/^v0\.4\./)) {
readUInt32 = function(b, offset, bigEndian) {
if(bigEndian) {
return ((b[offset]<<24)+
(b[offset+1]<<16)+
(b[offset+2]<<8)+
(b[offset+3]))>>>0;
}
else {
return ((b[offset+3]<<24)+
(b[offset+2]<<16)+
(b[offset+1]<<8)+
(b[offset]))>>>0;
}
};
}
else if(process.version == 'v0.5.3') {
readUInt32 = function(b, offset, bigEndian) {
return b.readUInt32(offset, bigEndian?"big":"little");
};
}
else if(process.version == 'v0.5.4') {
readUInt32 = function(b, offset, bigEndian) {
return b.readUInt32(offset, bigEndian);
};
}
else if(process.version == 'v0.5.5') {
readUInt32 = function(b, offset, bigEndian) {
if(bigEndian)
return b.readUInt32BE(offset);
else
return b.readUInt32LE(offset);
};
}
(function() {

@@ -17,4 +55,4 @@

var lastline = sz/10-1;
var lastip = buff.readUInt32(lastline*10+4, true);
var firstip = buff.readUInt32(0, true);
var lastip = readUInt32(buff, lastline*10+4, true);
var firstip = readUInt32(buff, 0, true);

@@ -30,4 +68,4 @@ lookup4 = function(ip) {

line = Math.round((cline-fline)/2)+fline;
floor = buff.readUInt32(line*10, true);
ceil = buff.readUInt32(line*10+4, true);
floor = readUInt32(buff, line*10, true);
ceil = readUInt32(buff, line*10+4, true);

@@ -87,3 +125,3 @@ if(floor <= ip && ceil >= ip) {

for(ii=0; ii<2; ii++)
ip.push(buff.readUInt32(line*34+offset*16+ii*4, true));
ip.push(readUInt32(buff, line*34+offset*16+ii*4, true));
return ip;

@@ -90,0 +128,0 @@ }

{
"name" : "geoip-lite",
"version" : "1.0.1",
"version" : "1.0.2",
"description" : "A light weight native JavaScript implementation of GeoIP API from MaxMind",

@@ -10,4 +10,5 @@ "keywords" : ["geo", "geoip", "ip", "ipv4", "ipv6", "geolookup", "maxmind", "geolite"],

"main" : "lib/geoip.js",
"repository" : { "type": "git", "url": "git://github.com/bluesmoon/node-geoip.git" }
"repository" : { "type": "git", "url": "git://github.com/bluesmoon/node-geoip.git" },
"engines" : { "node": "~0.4.11 || >=0.5.3" }
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc