Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssh-tun

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssh-tun - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

CHANGELOG.md
# Changelog
## 1.1.0 - 2016.08.31
* Add `user` option
## 1.0.0 - 2016.02.18
* Initial release

15

index.js

@@ -20,2 +20,3 @@ 'use strict';

* @param {number} opts.localport local port number
* @param {string} [opts.user] remote host user
* @param {number} [opts.maxRetries=5] max attempts to create tunnel

@@ -27,3 +28,5 @@ * @param {number} [opts.connectTimeout=10000] ssh connect timeout

this._port = this._generateRandomPort(opts.ports);
this.proxyUrl = util.format('%s:%d', this._host, this._port);
this._user = opts.user;
this.proxyHost = util.format('%s:%d', this._host, this._port);
this.proxyUrl = this.proxyHost; // deprecated, use proxyHost
this._localPort = opts.localport;

@@ -43,3 +46,3 @@ this._connectTimeout = opts.connectTimeout || DEFAULTS.CONNECT_TIMEOUT;

console.log('INFO: creating tunnel to %s', this.proxyUrl);
console.log('INFO: creating tunnel to %s', this.proxyHost);

@@ -91,3 +94,3 @@ this._tunnel = childProcess.spawn('ssh', this._buildSSHArgs());

_resolveTunnel: function () {
console.log('INFO: Tunnel created to %s', this.proxyUrl);
console.log('INFO: Tunnel created to %s', this.proxyHost);
this._tunnelDeferred.resolve();

@@ -97,3 +100,3 @@ },

_rejectTunnel: function () {
var message = util.format('ERROR: failed to create tunnel to %s.', this.proxyUrl),
var message = util.format('ERROR: failed to create tunnel to %s.', this.proxyHost),
error = new Error(message);

@@ -106,3 +109,3 @@

_closeTunnel: function (exitCode) {
console.log('INFO: Tunnel to %s closed. Exit code: %d', this.proxyUrl, exitCode);
console.log('INFO: Tunnel to %s closed. Exit code: %d', this.proxyHost, exitCode);
this._closeDeferred.resolve();

@@ -116,3 +119,3 @@ },

'-v',
this._host
(this._user ? this._user + '@' : '') + this._host
];

@@ -119,0 +122,0 @@ },

{
"name": "ssh-tun",
"version": "1.0.0",
"version": "1.1.0",
"description": "Module for establishing ssh tunnel",

@@ -5,0 +5,0 @@ "keywords": [

@@ -27,3 +27,3 @@ var Tunnel = require('../'),

describe('constructor', function () {
it('should generate proxy url from host and ports range', function () {
it('should generate proxy host from host and ports range', function () {
var tunnel = createTunnel({

@@ -34,3 +34,3 @@ host: 'test_host',

expect(tunnel.proxyUrl).to.match(/test_host:\d+/);
expect(tunnel.proxyHost).to.match(/test_host:\d+/);
});

@@ -43,3 +43,3 @@

expect(tunnel.proxyUrl).to.have.string(':8080');
expect(tunnel.proxyHost).to.have.string(':8080');
});

@@ -93,2 +93,16 @@

it('should spawn tunnel to remote host using provided user ', function () {
tunnel = createTunnel({
host: 'remote_host',
user: 'user',
localport: 8080
});
tunnel.open();
var sshArgs = childProcess.spawn.lastCall.args[1];
expect(sshArgs).to.contain('user@remote_host');
});
it('should resolve promise if tunnel successfully created', function () {

@@ -113,3 +127,3 @@ tunnel = createTunnel();

expect(tunnel.proxyUrl).to.match(/^some_ssh_host:\d+/);
expect(tunnel.proxyHost).to.match(/^some_ssh_host:\d+/);
});

@@ -137,3 +151,3 @@

expect(log)
.to.be.not.calledWith(util.format('ERROR: failed to create tunnel to %s.', tunnel.proxyUrl));
.to.be.not.calledWith(util.format('ERROR: failed to create tunnel to %s.', tunnel.proxyHost));
});

@@ -140,0 +154,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc