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

dispatch-proxy

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dispatch-proxy - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

19

lib/dispatcher/socks.js

@@ -1,2 +0,2 @@

var Dispatcher, SocksDispatcher, colog, net, socks,
var Dispatcher, SocksDispatcher, colog, dns, net, socks,
__hasProp = {}.hasOwnProperty,

@@ -13,2 +13,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

dns = require('dns');
module.exports = SocksDispatcher = (function(_super) {

@@ -22,8 +24,5 @@ __extends(SocksDispatcher, _super);

this.server = socks.createServer(function(clientConnection, _arg) {
var host, localAddress, port, serverConnection, _base, _name;
var host, localAddress, port, serverConnection;
host = _arg.host, port = _arg.port;
localAddress = _this.dispatchAddress();
(_base = _this.connectionsByAddress)[_name = localAddress.address] || (_base[_name] = 0);
_this.connectionsByAddress[localAddress.address]++;
_this.connectionsTotal++;
serverConnection = net.createConnection({

@@ -34,4 +33,8 @@ port: port,

});
serverConnection.on('error', function(err) {
clientConnection.end();
serverConnection.on('connect', function() {
var _base, _name;
(_base = _this.connectionsByAddress)[_name = localAddress.address] || (_base[_name] = 0);
_this.connectionsByAddress[localAddress.address]++;
return _this.connectionsTotal++;
}).on('error', function(err) {
return _this.emit('error', {

@@ -51,3 +54,3 @@ type: 'serverConnection',

serverConnection.end();
return this.emit('error', {
return _this.emit('error', {
type: 'clientConnection',

@@ -54,0 +57,0 @@ host: host,

@@ -84,5 +84,3 @@ var HttpDispatcher, SocksDispatcher, colog, os, print, program,

}
print(("" + type + " server started on ") + (colog.green("" + host + ":" + port)) + '\n');
print('Dispatching to addresses ');
print(((function() {
console.log("" + type + " server started on " + (colog.green("" + host + ":" + port)) + "\nDispatching to addresses " + (((function() {
var _l, _len2, _ref2, _results;

@@ -95,4 +93,3 @@ _results = [];

return _results;
})()).join(', '));
print('\n');
})()).join(', ')));
return dispatcher.on('error', function(_arg1, err) {

@@ -102,6 +99,7 @@ var host, localAddress , port, type;

if (type === 'server') {
return print(colog.red("" + type + " error"));
console.log("" + (colog.red("" + type + " error")));
} else {
return print((colog.red("" + type + " error: ")) + ("" + host + ":" + port + " on " + localAddress.address));
console.log("" + (colog.red("" + type + " error: ")) + " " + host + ":" + port + " on " + localAddress.address);
}
return print(err.stack);
});

@@ -108,0 +106,0 @@ });

@@ -49,2 +49,3 @@ var ADDRTYPE, AUTH, CMD, Consumable, EventEmitter, RSV, STATUS, SocksServer, VER, net, u,

this.listen = __bind(this.listen, this);
this.getConnections = __bind(this.getConnections, this);
this._requestHandler = __bind(this._requestHandler, this);

@@ -113,2 +114,8 @@ this._authenticationHandler = __bind(this._authenticationHandler, this);

SocksServer.prototype.getConnections = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this.server).getConnections.apply(_ref, args);
};
SocksServer.prototype.listen = function() {

@@ -115,0 +122,0 @@ var args, _ref;

@@ -5,3 +5,3 @@ {

"author": "Alexandre Kirszenberg <a.kirszenberg@gmail.com>",
"version": "0.0.2",
"version": "0.0.3",

@@ -8,0 +8,0 @@ "repository": {

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