mirror of
https://github.com/vale981/autossh
synced 2025-03-04 17:01:41 -05:00
remove dev logs
This commit is contained in:
parent
73a18b903d
commit
b7d2cf619f
3 changed files with 5 additions and 5 deletions
6
demo.js
6
demo.js
|
@ -2,11 +2,11 @@
|
||||||
const autossh = require('./index.js');
|
const autossh = require('./index.js');
|
||||||
|
|
||||||
// open 5 ssh tunnels
|
// open 5 ssh tunnels
|
||||||
for (let i = 0; i < 5; i++) {
|
// for (let i = 0; i < 5; i++) {
|
||||||
|
|
||||||
// set up config
|
// set up config
|
||||||
autossh({
|
autossh({
|
||||||
host: 'xyz.xy.xyz.yz', // enter host address
|
host: '192.241.216.152', // enter host address
|
||||||
username: 'same', // enter username
|
username: 'same', // enter username
|
||||||
localPort: 'auto', // 'auto' or port number
|
localPort: 'auto', // 'auto' or port number
|
||||||
remotePort: 5432
|
remotePort: 5432
|
||||||
|
@ -23,7 +23,7 @@ for (let i = 0; i < 5; i++) {
|
||||||
console.log(`tunnel established from localhost:${connection.localPort} to ${connection.host}:${connection.remotePort} as ${connection.username}`);
|
console.log(`tunnel established from localhost:${connection.localPort} to ${connection.host}:${connection.remotePort} as ${connection.username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* Possible output example (localPort results are be random)
|
/* Possible output example (localPort results are be random)
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -50,7 +50,7 @@ var AutoSSH = function (_EventEmitter) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var port = _this.localPort === 'auto' ? _this.generateRandomPort() : _this.localPort;
|
var port = _this.localPort === 'auto' ? _this.generateRandomPort() : _this.localPort;
|
||||||
console.log('checkpoint 1');
|
|
||||||
_portfinder2.default.getPort({ port: port }, function (err, freePort) {
|
_portfinder2.default.getPort({ port: port }, function (err, freePort) {
|
||||||
if (err) return _this.emit('error', 'Port error: ' + err);
|
if (err) return _this.emit('error', 'Port error: ' + err);
|
||||||
if (_this.localPort !== 'auto' && _this.localPort !== freePort) return _this.emit('error', 'Port ' + _this.localPort + ' is not available');
|
if (_this.localPort !== 'auto' && _this.localPort !== freePort) return _this.emit('error', 'Port ' + _this.localPort + ' is not available');
|
||||||
|
|
|
@ -24,7 +24,7 @@ class AutoSSH extends EventEmitter {
|
||||||
return confErrors.forEach(err => this.emit('error', err));
|
return confErrors.forEach(err => this.emit('error', err));
|
||||||
|
|
||||||
const port = this.localPort === 'auto' ? this.generateRandomPort() : this.localPort;
|
const port = this.localPort === 'auto' ? this.generateRandomPort() : this.localPort;
|
||||||
console.log('checkpoint 1');
|
|
||||||
portfinder.getPort({ port }, (err, freePort) => {
|
portfinder.getPort({ port }, (err, freePort) => {
|
||||||
if (err)
|
if (err)
|
||||||
return this.emit('error', 'Port error: ' + err);
|
return this.emit('error', 'Port error: ' + err);
|
||||||
|
|
Loading…
Add table
Reference in a new issue