• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mattcg/socks5-https-client: SOCKS v5 HTTPS client implementation in JavaScript f ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

mattcg/socks5-https-client

开源软件地址:

https://github.com/mattcg/socks5-https-client

开源编程语言:

JavaScript 96.6%

开源软件介绍:

SOCKS5 HTTPS Client

Build Status

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

var shttps = require('socks5-https-client');

shttps.get({
	hostname: 'encrypted.google.com',
	path: '/',
	rejectUnauthorized: true // This is the default.
}, function(res) {
	res.setEncoding('utf8');
	res.on('readable', function() {
		console.log(res.read()); // 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.

Username and password authentication is supported with the socksUsername and socksPassword options.

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

Using with Tor

Works great for making HTTPS requests through Tor.

Make sure a Tor server is running locally and run node example/tor https://check.torproject.org/ to test.

Using with Request

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

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

request({
	url: 'https://encrypted.google.com/',
	strictSSL: true,
	agentClass: Agent,
	agentOptions: {
		socksHost: 'my-tor-proxy-host', // Defaults to 'localhost'.
		socksPort: 9050, // Defaults to 1080.

		// Optional credentials
		socksUsername: 'proxyuser',
		socksPassword: 'p@ssw0rd',
	}
}, function(err, res) {
	console.log(err || res.body);
});

HTTP

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

License

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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap