node-http-socket5代理

node-http-socket5

 2018-11-16  server  server  2  评论 字数统计: 69(字) 阅读时长: 1(分)

request moudle 使用socket5 代理访问https网页

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const request = require('request');

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

request({
	url: 'https://google.com/',
	strictSSL: true,
	agentClass: Agent,
	agentOptions: {
		socksHost: 'localhost', // Defaults to 'localhost'.
		socksPort: 1086, // Defaults to 1080.

	}
}, function(err, res) {
	console.log(err || res.body);
});

参考资料;
SOCKS5 HTTPS Client
Add Socks Proxy support

  • 本文链接: https://dreamerjonson.com/2018/11/16/node-http-socket5/
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY 4.0 CN协议 许可协议。转载请注明出处!

 

郑建勋(jonson)区块链工程师 & Web工程师

灾难总是接踵而至,这正是世间的常理。你以为只要哭诉一下,就会有谁来救你吗?如果失败了,就只能说明我不过是如此程度的男人。

你可能感兴趣的:(nodejs,前端)