|
|
|
@ -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
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|