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

limitd-client

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limitd-client - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

4

client.js

@@ -49,6 +49,6 @@ var url = require('url');

decoded = ResponseMessage.decode(chunk);
callback(null, decoded);
} catch(err) {
callback(err);
return callback(err);
}
callback(null, decoded);
}))

@@ -55,0 +55,0 @@ .on('data', function (response) {

{
"name": "limitd-client",
"version": "1.7.0",
"version": "1.7.1",
"description": "limitd client for node.js",

@@ -19,3 +19,2 @@ "main": "index.js",

"reconnect-net": "0.0.0",
"remove": "~0.1.5",
"through2": "~2.0.0"

@@ -26,3 +25,3 @@ },

"mocha": "~2.2.4",
"through": "~2.3.7"
"through": "~2.3.8"
},

@@ -29,0 +28,0 @@ "homepage": "https://github.com/limitd/node-client",

@@ -33,3 +33,2 @@ var LimitdClient = require('../');

assert.isString(request.id);
assert.equal(request.method, protocol.Request.Method[method.toUpperCase()]);

@@ -36,0 +35,0 @@ assert.equal(request.type, 'ip');

var net = require('net');
var util = require('util');
var through = require('through');
var lps = require('length-prefixed-stream');
var through2 = require('through2');
var EventEmitter = require('events').EventEmitter;
var pbStream = require('pb-stream');
var protocol = require('../lib/protocol');

@@ -16,4 +16,4 @@

var decoder = pbStream.decoder(protocol.Request);
var encoder = pbStream.encoder(protocol.Response);
// var decoder = pbStream.decoder(protocol.Request);
// var encoder = pbStream.encoder(protocol.Response);

@@ -23,13 +23,35 @@ this._server = net.createServer(function (socket) {

socket.pipe(decoder)
.pipe(through(function (request) {
socket.pipe(lps.decode())
.pipe(through2.obj(function (chunk, enc, callback) {
var decoded;
try {
decoded = protocol.Request.decode(chunk);
} catch(err) {
console.log(err);
return callback(err);
}
callback(null, decoded);
}))
.pipe(through2.obj(function (request, enc, callback) {
var stream = this;
var replier = function (response) {
stream.queue(response);
stream.push(response);
};
self.emit('request', request, replier);
callback();
}))
.pipe(encoder)
.pipe(through2.obj(function (response, enc, callback) {
var encoded;
try {
encoded = response.encodeDelimited().toBuffer();
} catch(err) {
return callback(err);
}
callback(null, encoded);
}))
.pipe(socket);

@@ -36,0 +58,0 @@

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