in Education by
I have been looking at using the ssh2 module for sftp shipping of logs. However the cloud service hosting our app uses a rotating ip address range. So wanting to integrate the socks5 proxy service that is giving us the static ip address. I'm using the socksjs module to get the socks5 connection established, I'm getting the connection to the proxy, but I think I have the injecting of that socket connection for the sftp to use wrong. Cheers, Nik var sockConn = new SocksConnection(connTargetSettings, connProxySettings); connTargetSettings.sock = sockConn.outSocket; var conn = new ssh2.Client(); conn.on("ready", function() { conn.sftp(function(err, sftp) { if (err) throw err; // you'll be able to use sftp here sftp.readdir("/", function(err, list) { if (err) throw err; // List the directory in the console console.dir(list); // Do not forget to close the connection, otherwise you'll get troubles conn.end(); }); // Use sftp to execute tasks like .unlink or chmod etc }); }).connect(connTargetSettings); JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You can use socksv5 library(it's from creator of ssh2) to connect throw socks5 proxy. Example: var socks = require('socksv5'), SSHClient = require('ssh2').Client; socks.connect({ host: 'ssh.example.org', // destination port: 22, proxyHost: '127.0.0.1', proxyPort: 1080, auths: [ socks.auth.None() ] }, function(socket) { var conn = new SSHClient(); conn.on('ready', function() { conn.exec('uptime', function(err, stream) { if (err) throw err; stream.on('close', function(code, signal) { conn.end(); }).on('data', function(data) { console.log('STDOUT: ' + data); }).stderr.on('data', function(data) { console.log('STDERR: ' + data); }); }); }).connect({ sock: socket, username: 'frylock', privateKey: require('fs').readFileSync('/here/is/my/key') }); });

Related questions

0 votes
    so i'm reviewing and practicing making rest api with node mongoose and express. I'm having problem making ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I'm trying to debug my nodejs app using node-inspector. But Google Chrome doesn't show the code. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    Quick Summary of my question: Does Gulp 3.6.0 dest() handle glob-base the same way as 4.0.0? ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    What I'm trying to do here is use the 2 functions but I don't know how to use both of them ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    What I'm trying to do here is use the 2 functions but I don't know how to use both of them ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    The napi_create_date function appeared in Node.js starting with 11.11.0 version. https://nodejs.org/api/n- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    i'm trying to test with jest this route on my node microservice. At the initalisation of my microservice ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I've been putzing with trying to call the jobs.Insert bigquery rest api endpoint with node (the jobs. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I'm trying to use node to print the Serial from Arduino uno connected to USB I have a file script ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    I'm used to v3 node botbuilder sdk so I have a middleware where I look at the dialog stack and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    What is a Node?...
asked Nov 20, 2020 in Education by Editorial Staff
0 votes
    I'm trying to include actual date and time to the certain message, however I'm unable to do it, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    axios.js throws CONNRESET error (certificate not found in request) but request package works for same p12 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I have an application using Bull for a queue. Is there a parameter that I can pass it to set a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I'm trying to make a form-maker with Node.Js and MongoDB but confused about the data structure. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
...