feat(p2p): tunnels support for bad peers

This commit is contained in:
Alexey Kasyanchuk
2018-03-17 20:58:50 +03:00
parent 9f1a7eef83
commit 500b852209
5 changed files with 108 additions and 12 deletions

View File

@ -19,13 +19,13 @@ const startSSH = (port, host, user, password, callback) => {
}
const options = [
'-N',
'-T',
'-R', `0.0.0.0:${remotePort}:127.0.0.1:${port}`,
`${user}@${host}`,
'-pw', password,
'-v'
]
console.log(options)
const ssh = spawn(appPath('plink'), options)
@ -56,15 +56,13 @@ const startSSH = (port, host, user, password, callback) => {
if(data.includes('Password authentication failed'))
{
ssh.kill()
if(callback)
callback(false)
}
});
ssh.on('close', (code, signal) => {
console.log(`ssh closed with code ${code} and signal ${signal}`)
if(callback)
callback(false)
console.log(`ssh closed with code ${code} and signal ${signal}`)
})
return ssh