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

node-http-socket5_区块链