Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tunnel({
dstPort: 8000,
//srcHost: '127.0.0.1', // default
//srcPort: dstPort // default is the same as dstPort
//privateKey: require('fs').readFileSync('/Your/Private/Key');
}, function(error, clientConnection) {
//
});
Expand All @@ -35,6 +36,8 @@ var conn = tunnel({
dstPort: 0, // dynamically choose an open port on tunneltest.com
//srcHost: '127.0.0.1', // default
srcPort: 8000, // must be specified if dstPort=0
//privateKey: require('fs').readFileSync('/Your/Private/Key');

}, function (error, clientConnection) {
//
});
Expand Down
7 changes: 6 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ function createConfig(userConfig) {
srcHost: 'localhost',
dstPort: null,
dstHost: 'localhost',
localHost: 'localhost'
localHost: 'localhost',
privateKey: null
});

// Try to use ssh-agent if no auth information was set
if (!config.password && !config.privateKey) {
config.agent = config.agent || process.env.SSH_AUTH_SOCK;
}

if (userConfig.privateKey !== null) {
config.privateKey = userConfig.privateKey
}

// No local route, no remote route.. exit here
if (config.dstPort === null || !config.dstHost || !config.host) {
throw new Error('invalid configuration.');
Expand Down