mirror of
https://github.com/vale981/autossh
synced 2025-03-05 09:21:40 -05:00
adds readme
This commit is contained in:
parent
91b27e11bd
commit
9811a67d71
2 changed files with 62 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
*.log
|
*.log
|
||||||
|
README.html
|
||||||
|
|
61
README.md
Normal file
61
README.md
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# autossh
|
||||||
|
|
||||||
|
Persistent SSH tunnels
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
|
Using npm
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i -S autossh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
#### To Start
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
const autossh = require('autossh');
|
||||||
|
|
||||||
|
autossh({
|
||||||
|
host: '111.22.333.444',
|
||||||
|
username: 'root',
|
||||||
|
localPort: 64444,
|
||||||
|
remotePort: 5432
|
||||||
|
})
|
||||||
|
.on('error', err => {
|
||||||
|
console.error('ERROR: ', err);
|
||||||
|
})
|
||||||
|
.on('init', () => {
|
||||||
|
console.log('connected. Ready to do other stuff.');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
...is equivalent to...
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
ssh -NL 64444:localhost:5432 root@111.22.333.444
|
||||||
|
```
|
||||||
|
|
||||||
|
#### To Kill
|
||||||
|
|
||||||
|
The autossh process will automatically die if the node process is closed, but you can manually kill the process using `kill`.
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
const myAutossh = autossh({
|
||||||
|
host: '111.22.333.444',
|
||||||
|
username: 'root',
|
||||||
|
localPort: 64444,
|
||||||
|
remotePort: 5432
|
||||||
|
})
|
||||||
|
.on('error', err => {
|
||||||
|
console.error('ERROR: ', err);
|
||||||
|
})
|
||||||
|
.on('init', () => {
|
||||||
|
console.log('connected. Ready to do other stuff.');
|
||||||
|
});
|
||||||
|
|
||||||
|
myAutossh.kill();
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue