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

socks-proxy-agent

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socks-proxy-agent - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

10

History.md
1.0.0 / 2015-02-11
==================
* add client-side DNS lookup logic for 4 and 5 version socks proxies
* remove dead `onproxyconnect()` code function
* use a switch statement to decide the socks `version`
* refactor to use "socks-client" instead of "rainbowsocks"
* package: remove "rainbowsocks" dependency
* package: allow any "mocha" v2
0.1.2 / 2014-06-11

@@ -3,0 +13,0 @@ ==================

8

package.json
{
"name": "socks-proxy-agent",
"version": "0.1.2",
"version": "1.0.0",
"description": "A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS",

@@ -29,8 +29,8 @@ "main": "socks-proxy-agent.js",

"agent-base": "~1.0.1",
"rainbowsocks": "~0.1.2",
"extend": "~1.2.1"
"extend": "~1.2.1",
"socks-client": "~1.1.2"
},
"devDependencies": {
"mocha": "~1.18.2"
"mocha": "2"
}
}

@@ -8,5 +8,6 @@

var url = require('url');
var dns = require('dns');
var extend = require('extend');
var Agent = require('agent-base');
var RainbowSocks = require('rainbowsocks');
var SocksClient = require('socks-client');
var inherits = require('util').inherits;

@@ -54,2 +55,23 @@

// figure out if we want socks v4 or v5, based on the "protocol" used.
// Defaults to 5.
proxy.lookup = false;
switch (proxy.protocol) {
case 'socks4:':
proxy.lookup = true;
// pass through
case 'socks4a:':
proxy.version = 4;
break;
case 'socks5:':
proxy.lookup = true;
// pass through
case 'socks:': // no version specified, default to 5h
case 'socks5h:':
proxy.version = 5;
break;
default:
throw new TypeError('A "socks" protocol must be specified! Got: ' + proxy.protocol);
}
this.proxy = proxy;

@@ -87,8 +109,2 @@ }

// called once the SOCKS proxy has been connected to
function onproxyconnect (err) {
if (err) return fn(err);
socks.connect(opts.host, opts.port, onhostconnect);
}
// called once the SOCKS proxy has connected to the specified remote endpoint

@@ -108,2 +124,3 @@ function onhostconnect (err, socket) {

s = tls.connect(opts);
socket.resume();
}

@@ -113,4 +130,29 @@ fn(null, s);

var socks = new RainbowSocks(proxy.port, proxy.host);
socks.once('connect', onproxyconnect);
// called for the `dns.lookup()` callback
function onlookup (err, ip, type) {
if (err) return fn(err);
options.target.host = ip;
SocksClient.createConnection(options, onhostconnect);
}
var options = {
proxy: {
ipaddress: proxy.host,
port: proxy.port,
type: proxy.version
},
target: {
port: opts.port
},
command: 'connect'
};
if (proxy.lookup) {
// client-side DNS resolution for "4" and "5" socks proxy versions
dns.lookup(opts.host, onlookup);
} else {
// proxy hostname DNS resolution for "4a" and "5h" socks proxy servers
options.target.host = opts.host;
SocksClient.createConnection(options, onhostconnect);
}
}
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