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

strong-tunnel

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strong-tunnel - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

test/example.js

8

CHANGES.md

@@ -0,1 +1,9 @@

2015-09-16, Version 1.1.3
=========================
* test: generate cobertura coverage reports (Ryan Graham)
* test: make example and test-example separate (Ryan Graham)
2015-06-03, Version 1.1.2

@@ -2,0 +10,0 @@ =========================

6

package.json
{
"name": "strong-tunnel",
"version": "1.1.2",
"version": "1.1.3",
"description": "Semi-transparent wrapper for arbitrary network connections over ssh2",

@@ -9,3 +9,3 @@ "main": "index.js",

"pretest": "eslint . && jscs .",
"test": "tap test/test-*.js"
"test": "tap --coverage --coverage-report=cobertura test/test-*.js"
},

@@ -34,3 +34,3 @@ "repository": {

"jscs": "^1.11.3",
"tap": "^0.6.0"
"tap": "^1.3.2"
},

@@ -37,0 +37,0 @@ "dependencies": {

@@ -1,44 +0,11 @@

var fmt = require('util').format;
var http = require('http');
var st = require('../');
var fork = require('child_process').fork;
var tap = require('tap');
var server = http.createServer(function(req, res) {
res.end(JSON.stringify(req.headers));
});
var sshOpts = {
host: '127.0.0.1',
};
server.listen(3030, function() {
var direct = 'http://127.0.0.1:3030/';
var tunneled = 'http+ssh://127.0.0.1:3030/';
// Standard request using URL string
http.get(direct, resLog('%s using %s:', direct, direct));
// URL is only modified if a tunnelling URL was given
st(direct, function(err, url) {
if (err) throw err;
// url == direct, unmodified
http.get(url, resLog('%s using %s:', direct, url));
tap.test('example script runs', function(t) {
var example = fork(require.resolve('./example'));
example.on('exit', function(code, signal) {
t.assert(!code, 'exit 0');
t.assert(!signal, 'not signalled to exit');
t.end();
});
// optional second argument containing ssh config
st(tunneled, sshOpts, function(err, url) {
if (err) throw err;
// url != tunneled, is modified
http.get(url, resLog('%s using %s:', tunneled, url));
});
server.unref();
});
function resLog(prefix) {
prefix = fmt.apply(null, arguments);
return function onResponse(res) {
res.on('data', function(d) {
console.log('%s -> %s', prefix, d);
});
};
}

Sorry, the diff of this file is not supported yet

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