-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from narekhovhannisyan/pass-connection-expire
Pass connection expire to node ssh extra instance
- Loading branch information
Showing
7 changed files
with
743 additions
and
4,952 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# node-ssh-extra | ||
|
||
[![Build Status](https://travis-ci.com/narekhovhannisyan/node-ssh-extra.svg?branch=master)](https://travis-ci.com/narekhovhannisyan/node-ssh-extra) | ||
|
||
|
||
[Node SSH](https://github.com/steelbrain/node-ssh) wrapper which helps to reuse existing connections. | ||
|
||
All connections are kept in cache and expire after given `connectionExpire` milliseconds. | ||
|
||
## Usage | ||
|
||
### For separate servers. | ||
``` | ||
const NodeSSHExtra = require('node-ssh-extra') | ||
NodeSSHExtra({ | ||
privateKey, // Private key path for ssh connection. | ||
host, // name for ssh connection. | ||
passphrase, // Passphrase for ssh connection. | ||
username, // User name for ssh connection. | ||
connectionExpire, // Milliseconds to expire ssh connections. | ||
domainOrIP // Domain or IP address to connect. | ||
}) | ||
.then((connection) => { | ||
// Do whatever you need to do here. | ||
}) | ||
``` | ||
|
||
### If all servers have the same connection credentials. | ||
|
||
``` | ||
const NodeSSHExtra = require('node-ssh-extra').NodeSSHExtraForSameCredentials({ | ||
privateKey, | ||
host, | ||
passphrase, | ||
username, | ||
connectionExpire | ||
}) | ||
NodeSSHExtra('mock-domain.com') | ||
.then((connection) => { | ||
// Do whatever you need to do here. | ||
}) | ||
// And after if you need to do some other thing with new connection just call NodeSSHExtra the same way. | ||
NodeSSHExtra('mock-domain.com') | ||
.then((connection) => { | ||
// Just continue doing what you need :) | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"checkJs": true | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"**/node_modules/*" | ||
] | ||
} |
Oops, something went wrong.