geoip-lite
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -11,2 +11,41 @@ var fs = require('fs'); | ||
// First we have to define writeUInt32 correctly based on the node version in use | ||
// Our fault for using unstable APIs | ||
var writeUInt32; | ||
if(process.version.match(/^v0\.4\./)) { | ||
writeUInt32 = function(b, value, offset, bigEndian) { | ||
if(bigEndian) { | ||
b[offset+0] = (value >> 24) & 0xff; | ||
b[offset+1] = (value >> 16) & 0xff; | ||
b[offset+2] = (value >> 8) & 0xff; | ||
b[offset+3] = (value >>> 0) & 0xff; | ||
} | ||
else { | ||
b[offset+3] = (value >> 24) & 0xff; | ||
b[offset+2] = (value >> 16) & 0xff; | ||
b[offset+1] = (value >> 8) & 0xff; | ||
b[offset+0] = (value >>> 0) & 0xff; | ||
} | ||
return true; | ||
}; | ||
} | ||
else if(process.version == 'v0.5.3') { | ||
writeUInt32 = function(b, value, offset, bigEndian) { | ||
return b.writeUInt32(value, offset, bigEndian?"big":"little"); | ||
}; | ||
} | ||
else if(process.version == 'v0.5.4') { | ||
writeUInt32 = function(b, value, offset, bigEndian) { | ||
return b.writeUInt32(value, offset, bigEndian); | ||
}; | ||
} | ||
else if((new Buffer(0).writeUInt32BE)) { | ||
writeUInt32 = function(b, value, offset, bigEndian) { | ||
if(bigEndian) | ||
return b.writeUInt32BE(value, offset); | ||
else | ||
return b.writeUInt32LE(value, offset); | ||
}; | ||
} | ||
var lastline = ""; | ||
@@ -31,5 +70,5 @@ | ||
for(i=0; i<sip.length; i++) | ||
b.writeUInt32(sip[i], i*4, true); | ||
writeUInt32(b, sip[i], i*4, true); | ||
for(i=0; i<eip.length; i++) | ||
b.writeUInt32(eip[i], 16+i*4, true); | ||
writeUInt32(b, eip[i], 16+i*4, true); | ||
} | ||
@@ -45,4 +84,4 @@ else { | ||
b.fill(0); | ||
b.writeUInt32(sip, 0, true); | ||
b.writeUInt32(eip, 4, true); | ||
writeUInt32(b, sip, 0, true); | ||
writeUInt32(b, eip, 4, true); | ||
} | ||
@@ -49,0 +88,0 @@ |
{ | ||
"name" : "geoip-lite", | ||
"version" : "1.0.3", | ||
"version" : "1.0.4", | ||
"description" : "A light weight native JavaScript implementation of GeoIP API from MaxMind", | ||
@@ -5,0 +5,0 @@ "keywords" : ["geo", "geoip", "ip", "ipv4", "ipv6", "geolookup", "maxmind", "geolite"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
1919797
357
0
4