Awesome Open Source
Awesome Open Source


Build Status

SOCKS v5 HTTP client implementation in JavaScript for Node.js.

var shttp = require('socks5-http-client');

shttp.get('', function(res) {
	res.on('readable', function() {
		console.log(; // Log response to console.

URLs are parsed using url.parse. You may also pass an options hash as the first argument to get or request.


Specify the socksHost and socksPort options if your SOCKS server isn't running on localhost:1080. Tor runs its SOCKS server on port 9050 by default, for example.

Specify a username and password using socksUsername and socksPassword.

Using with Tor

Works great for making HTTP requests through Tor.

Make sure a Tor server is running locally and run node example/tor to test.

Using with Request

To use with Request, just pass a reference to the Agent constructor.

var Agent = require('socks5-http-client/lib/Agent');

	url: '',
	agentClass: Agent,
	agentOptions: {
		socksHost: 'my-tor-proxy-host', // Defaults to 'localhost'.
		socksPort: 9050 // Defaults to 1080.
}, function(err, res) {
	console.log(err || res.body);


This client only provides support for making HTTP requests. See socks5-https-client for an HTTPS implementation.


Copyright © 2013 Matthew Caruana Galizia, licensed under an MIT license.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (66,070
tor (102
socks (47

Find Open Source By Browsing 7,000 Topics Across 59 Categories