Intial Commit
This commit is contained in:
17
nodered/rootfs/data/node_modules/socks5-https-client/example/tor-request.js
generated
vendored
Normal file
17
nodered/rootfs/data/node_modules/socks5-https-client/example/tor-request.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
/*jshint node:true*/
|
||||
|
||||
var request = require('request');
|
||||
|
||||
var Agent = require('../lib/Agent');
|
||||
|
||||
request({
|
||||
url: process.argv[2],
|
||||
agentClass: Agent,
|
||||
agentOptions: {
|
||||
socksPort: 9050 // Defaults to 1080.
|
||||
}
|
||||
}, function(err, res) {
|
||||
console.log(res.body);
|
||||
});
|
||||
33
nodered/rootfs/data/node_modules/socks5-https-client/example/tor.js
generated
vendored
Normal file
33
nodered/rootfs/data/node_modules/socks5-https-client/example/tor.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
/*jshint node:true*/
|
||||
|
||||
var url = require('url');
|
||||
var shttps = require('../');
|
||||
|
||||
var options = url.parse(process.argv[2]);
|
||||
|
||||
options.socksPort = 9050; // Tor default port.
|
||||
|
||||
var req = shttps.get(options, function(res) {
|
||||
res.setEncoding('utf8');
|
||||
|
||||
res.on('readable', function() {
|
||||
var data = res.read();
|
||||
|
||||
// Check for the end of stream signal.
|
||||
if (null === data) {
|
||||
process.stdout.write('\n');
|
||||
return;
|
||||
}
|
||||
|
||||
process.stdout.write(data);
|
||||
});
|
||||
});
|
||||
|
||||
req.on('error', function(e) {
|
||||
console.error('Problem with request: ' + e.message);
|
||||
});
|
||||
|
||||
// GET request, so end without sending any data.
|
||||
req.end();
|
||||
Reference in New Issue
Block a user