SOCKS v5 HTTP client.
var shttp = require'socks5-http-client';shttpget''ressetEncoding'utf8';reson'readable'console.logresread; // Log response to console.;;
URLs are parsed using
url.parse. You may also pass an options hash as the first argument to
socksPort options if your SOCKS server isn't running on
localhost:1080. Tor runs its SOCKS server on port
9050 by default, for example.
Works great for making HTTPS requests through Tor.
Make sure a Tor server is running locally and run
node example/tor http://en.wikipedia.org/wiki/SOCKS to test.
To use with Request, just pass an agent instance.
var Agent = require'socks5-http-client/lib/Agent';requesturl: ''agentClass: AgentagentOptions:socksHost: 'my-tor-proxy-host' // Defaults to 'localhost'.socksPort: 9050 // Defaults to 1080.console.logerr || resbody;;
This client only provides support for making HTTP requests. See socks5-https-client for an HTTPS implementation.