Package Exports
- socks5-http-client
- socks5-http-client/lib/Agent
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (socks5-http-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SOCKS5 HTTP Client
SOCKS v5 HTTP client implementation in JavaScript for Node.js.
var shttp = require('socks5-http-client');
shttp.get('http://www.google.com/', function(res) {
res.setEncoding('utf8');
res.on('readable', function() {
console.log(res.read()); // 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.
Using with Tor
Works great for making HTTP requests through Tor (see bundled example).
Using with Request
To use with Request, just pass an agent instance.
var Socks5ClientHttpAgent = require('socks5-http-client/lib/Agent');
request({
url: 'http://www.google.com/',
agent: new Socks5ClientHttpAgent({
socksHost: 'my-tor-proxy-host', // Defaults to 'localhost'.
socksPort: 9050 // Defaults to 1080.
})
}, function(err, res) {
console.log(res);
});HTTPS
This client only provides support for making HTTP requests. See socks5-https-client for an HTTPS implementation.
License
Copyright © 2013 Matthew Caruana Galizia, licensed under an MIT license.
