Adit
Forward all your stuff through ssh tunnel.
There is a lot of examples out there how this could be useful, for example, check out "SSH Tunnel - Local and Remote Port Forwarding Explained With Examples"
Usage
ssh and Adit
$ ssh -L 9000:imgur.com:80 example.com
new Adit('9000:imgur.com:80 example.com').forward().then(adit => {
console.log('success');
adit.close();
});
$ ssh -R 9000:localhost:3000 example.com
new Adit('9000:localhost:3000 example.com').reverse().then(adit => {
console.log('success');
adit.close();
});
Listen for events
let server = new Adit(...);
server.on('ready', ...);
server.on('tcp connection', ...)
server.on('error', ...);
server.on('data', ...);
server.forward(...).then(...);
Thorough
import Adit from 'adit';
let adit = new Adit({
host: `example.com`
});
let adit = new Adit('example.com');
adit.open(3).then(connection => {
connection.out({
host: 'example.com'
port: 80
}, {
host: 'localhost'
port: 8080,
}).then(() => {
});
connection.in({
host: 'example.com'
port: 80,
}, {
host: 'localhost'
port: 8080
}).then(() => {
});
}, error => {
console.error(error);
});
adit.on('error', () => {
});
adit.close();
Authentification strategy
- If
password
is defined - use it - If
agent
or key
is defined explicitly - use one of them, prioritize the agent
- If
agent
or key
is not passed - use environment varibles (SSH_AUTH_SOCK
for agent
)
Note: if key
is used, assume it is added without passphrase, otherwise you should use agent