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协议 许可协议。转载请注明出处!

node-http-socket5_第1张图片