tunnel-ssh
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -11,2 +11,3 @@ var net = require('net'); | ||
var sshConnection = new Connection(); | ||
netConnection.on('close', sshConnection.end.bind(sshConnection)); | ||
@@ -34,3 +35,2 @@ sshConnection.on('ready', function () { | ||
var server; | ||
var sshConnection; | ||
var connections = []; | ||
@@ -40,2 +40,3 @@ var connectionCount = 0; | ||
server = net.createServer(function (netConnection) { | ||
var sshConnection; | ||
connectionCount++; | ||
@@ -42,0 +43,0 @@ netConnection.on('error', server.emit.bind(server, 'error')); |
@@ -37,13 +37,13 @@ var util = require('util'); | ||
} | ||
debug('ssh-config', (function(){ | ||
var hiddenValues = ['password','privateKey']; | ||
debug('ssh-config', (function () { | ||
var hiddenValues = ['password', 'privateKey']; | ||
return Object.keys(config).reduce(function(obj, key){ | ||
if(hiddenValues.indexOf(key) === -1){ | ||
obj[key] = config[key]; | ||
}else{ | ||
obj[key] = '***HIDDEN***' | ||
} | ||
return Object.keys(config).reduce(function (obj, key) { | ||
if (hiddenValues.indexOf(key) === -1) { | ||
obj[key] = config[key]; | ||
} else { | ||
obj[key] = '***HIDDEN***'; | ||
} | ||
return obj; | ||
},{}) | ||
}, {}); | ||
})()); | ||
@@ -50,0 +50,0 @@ |
{ | ||
"name": "tunnel-ssh", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "Easy extendable SSH tunnel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,8 +11,8 @@ Tunnel-SSH | ||
### Latest Relese 4.1.2 | ||
### Latest Relese 4.1.3 | ||
##Highlights | ||
* Updated packages to the latest versions | ||
* Add "npm test" for eslint and mocha | ||
* Password and PrivateKey are hidden when using Debug (DEBUG=tunnel-ssh-config) | ||
## Release notes | ||
* Closing sshconnections correctly thx @actionshrimp | ||
* Improved readme | ||
* Updated modules | ||
@@ -23,3 +23,3 @@ Special thanks to | ||
### related projects | ||
### Related projects | ||
* [If you don't want to wrap a tunnel around your code: inject-tunnel-ssh](https://github.com/agebrock/inject-tunnel-ssh) | ||
@@ -91,2 +91,3 @@ * [If you need it the other way around: reverse-tunnel-ssh](https://github.com/agebrock/reverse-tunnel-ssh) | ||
username:'root', | ||
Password:'secret', | ||
host:sshServer, | ||
@@ -107,9 +108,5 @@ port:22, | ||
In many cases host 1. and 2. are the same, for example if you want to connect to a database | ||
where the port from that database is bound to a local interface (127.0.0.1:27017) | ||
but you are able to connect via ssh (port 22 by default). | ||
You can skip the "dstHost" or the "host" configuration if they are the same. | ||
You can also skip the local configuration if you want to connect to localhost and | ||
the same port as "dstPort". | ||
tunnel-ssh assumes that you want to map the same port on a remote machine to your localhost using the ssh-server on the remote machine. | ||
```js | ||
@@ -119,28 +116,16 @@ | ||
username:'root', | ||
dstHost:destinationServer, | ||
dstPort:27017 | ||
dstHost:'remotehost.with.sshserver.com', | ||
dstPort:27017, | ||
privateKey:require(fs.readFileSync('/path/to/key'), | ||
passphrase:'secret' | ||
}; | ||
var tunnel = require('tunnel-ssh'); | ||
tunnel(config, function (error, server) { | ||
//.... | ||
}); | ||
``` | ||
#### More configuration options | ||
tunnel-ssh pipes the configuration direct into the ssh2 library so every config option | ||
provided by ssh2 still works. | ||
tunnel-ssh pipes the configuration direct into the ssh2 library so every config option provided by ssh2 still works. | ||
[ssh2 configuration](https://github.com/mscdex/ssh2#client-methods) | ||
Common examples are: | ||
```js | ||
var config = { | ||
agent : process.env.SSH_AUTH_SOCK, // enabled by default | ||
privateKey:require('fs').readFileSync('/here/is/my/key'), | ||
password:'secret' | ||
} | ||
``` | ||
####catch errors: | ||
#### catching errors: | ||
```js | ||
@@ -147,0 +132,0 @@ var tunnel = require('tunnel-ssh'); |
357
17120
140