Browse Source

🥅 Catch SSH connect errors

master
KaKi87 2 months ago
parent
commit
c6843db06f
1 changed files with 20 additions and 8 deletions
  1. +20
    -8
      lib/ssh.js

+ 20
- 8
lib/ssh.js View File

@ -33,19 +33,31 @@ module.exports = {
client.on('end', () => prevClient.end());
prevClient.forwardOut('127.0.0.1', 12345 + i, address, port, (error, prevClientStream) => {
if(error) onError(error);
try {
client.connect({
sock: prevClientStream,
username,
password
});
}
catch(error){
onError(error);
}
});
}
else {
try {
client.connect({
sock: prevClientStream,
host: address,
port,
username,
password
});
});
}
catch(error){
onError(error);
}
}
else client.connect({
host: address,
port,
username,
password
});
});
}
})();


Loading…
Cancel
Save