npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-reverse-wstunnel

v1.0.0

Published

Tools to establish a TCP socket tunnel over websocket connection, and to enstabilish a reverse tunnel over websocket connection, for circumventing the problems of direct connections to the host behind a strict firewalls or without a public IP.

Downloads

13

Readme

Tunnel and Reverse Tunnel Client and Server implementation over WS/WSS protocol for Node.js

npm version

NPM

NPM

Overview

Tools to establish a TCP socket tunnel over websocket connection, and to enstabilish a reverse tunnel over websocket connection, for circumventing the problems of direct connections to the host behind a strict firewalls or without a public IP.

Installation

npm install node-reverse-wstunnel

Usage for a Node.js application

Instantiation of a tunnel server

const wst = require("../lib/wst_wrapper").server;

//Instance of a new WebSocker Tunnel Server Object specifying the TCP port on which it will be listening
let server = new wst(8888);
//Start the server
server.start(port);

Implementation of a tunnel client

const wst = require("../lib/wst_wrapper").client;

let client = new wst();

/*
<publicPortOnServer> is the port on the public reverse tunnel server on which the service will be reachable
<WSHost> is the remote host on which the reverse tunnel server is started  expressed in the following form 'ws://<hostname>:<port>'
<remoteHost>:<remotePort> is the end point of the service for the defined tunnel
*/
client.start('<publicPortOnServer>', '<WSHost>', '<remoteHost>:<remotePort>');

Instantiation of a reverse tunnel server

const wst = require("../lib/wst_wrapper").server_reverse;

//Instance of a new WebSocker Reverse Tunnerl Server Object specifying the TCP port on which it will be listening
let server = new wst(8888);
//Start the server
server.start(port);

Implementation of a reverse tunnel client

const wst = require("../lib/wst_wrapper").client_reverse;

let client = new wst();

/*
<publicPortOnServer> is the port on the public reverse tunnel server on which the service will be reachable
<WSHost> is the remote host on which the reverse tunnel server is started  expressed in the following form 'ws://<hostname>:<port>'
<remoteHost>:<remotePort> is the end point of the service for the defined tunnel
*/
client.start('<publicPortOnServer>', '<WSHost>', '<remoteHost>:<remotePort>');

Usage of wst.js executable

Using the wst.js executable located in bin directory:

For running a websocket tunnel server:

./wstt.js -s 8080

For running a websocket tunnel client:

./wstt.js -tunnel 33:2.2.2.2:33 ws://host:8080

In the above example, client picks the final tunnel destination, similar to ssh tunnel. Alternatively for security reason, you can lock tunnel destination on the server end, example:

Server:

    ./wstt.js -s 8080 -t 2.2.2.2:33

Client:

    ./wstt.js -t 33 ws://server:8080

In both examples, connection to localhost:33 on client will be tunneled to 2.2.2.2:33 on server via websocket connection in between.

For running a websocket reverse tunnel server:

./wstt.js -r -s 8080

For running a websocket reverse tunnel client:

./wstt.js -r 6666:2.2.2.2:33 ws://server:8080

In the above example the client tells the server to open a TCP server on port 6666 and all connection on this port are tunneled to the client that is directely connected to 2.2.2.2:33