reverse-websocket-tunnel
v1.4.1
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
10
Readme
reverse-websocket-tunnel
Overview
reverse-websocket-tunnel
is modified version from node-reverse-tunnel
and it only provides you reverse tunnel.
Installation
yarn global add reverse-websocket-tunnel
Usage
Server Side
// create randome secret with crypto module
const crypto = require("crypto");
const secret = crypto.randomBytes(8).toString('hex');
const { ServerReverse } = require('reverse-websocket-tunnel');
// create a new socket
const server = new ServerReverse(secret);
// start server at port 8000
server.start({ port: 8000 });
Client Side
const { ClientReverse } = require('reverse-websocket-tunnel');
// create a new socket client, secret is obtain from server
const client = new ClientReverse(secret);
// pipe port 3000 to remote server:8000 at port 8001
client.start({ port: 3000, tcpPort: 8001, address: 'http://remote:8000' });