SOCKS v5 HTTPS client.


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

var shttps = require('socks5-https-client');
    hostname: '',
    path: '/',
    rejectUnauthorized: true // This is the default. 
}, function(res) {
    res.on('readable', function() {
        console.log(; // Log response to console. 

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.

You may also pass a URL as the first argument to get or request, which will be parsed using url.parse.

Works great for making HTTPS requests through Tor.

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

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

var Agent = require('socks5-https-client/lib/Agent');
    url: '',
    strictSSL: true,
    agentClass: Agent,
    agentOptions: {
        socksHost: 'my-tor-proxy-host', // Defaults to 'localhost'. 
        socksPort: 9050 // Defaults to 1080. 
}, function(errres) {
    console.log(err || res.body);

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

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