Giter Site home page Giter Site logo

socks5-http-client's Introduction

SOCKS5 HTTP Client

Build Status

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 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.

Using with Request

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

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

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

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.

socks5-http-client's People

Contributors

josepot avatar mattcg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.