Registry / devops / cactus-tunnel

cactus-tunnel

JSON →
library0.4.0jsnpmunverified

A TCP tunnel tool that uses WebSocket and browser to establish tunnels through restrictive networks. Current stable version is 0.4.0. Requires Node.js >= 22. Allows bridging TCP connections over WebSocket with a bridge mode that provides a live dashboard. Key differentiators: works in browser, simple CLI, and bridge mode with Web UI.

npm install cactus-tunnel
INSTALL
IMPORT
SIG · CACTUS-TUNNEL
C
cactus-tunnel
devopsjavascriptv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
import { Client } from 'cactus-tunnel'
const Client = require('cactus-tunnel').Client
ESM-only since v0.4.0; CommonJS require will fail.
Server
import { Server } from 'cactus-tunnel'
const { Server } = require('cactus-tunnel')
ESM-only; use dynamic import() if needed in CJS.
createTunnel
import { createTunnel } from 'cactus-tunnel'
Factory function to create tunnel instances.

Demonstrates setting up a cactus-tunnel server and client, forwarding WebSocket to a local TCP server.

import { Server, Client } from 'cactus-tunnel'; import { createServer } from 'net'; // Start server const server = new Server({ port: 7800 }); await server.listen(); // Start a local TCP server const localServer = createServer((socket) => { socket.write('Hello from tunnel!\n'); socket.end(); }).listen(8080); // Connect client to server and forward to local TCP server const client = new Client('ws://localhost:7800', 'tcp://localhost:8080'); await client.connect(); // Test connection const net = await import('net'); const testSocket = net.connect(7800, () => { testSocket.write('test'); }); testSocket.on('data', (data) => console.log(data.toString())); process.on('SIGINT', () => { client.close(); server.close(); localServer.close(); });
Debug
Known issues
breakingcactus-tunnel v0.4.0 is ESM-only. CommonJS require() will throw error.
fix
Use ES modules: add '\"type\": \"module\"' in package.json or use .mjs extension.
affects: >=0.4.0
breakingMinimum Node.js version is now 22.
fix
Upgrade Node.js to v22 or later.
affects: >=0.4.0
gotchaBridge mode Web UI only available when running in server mode with default options? Check documentation.
fix
Use 'cactus-tunnel server' command without specifying '--bridge' if needed.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
Using CommonJS require() to import cactus-tunnel which is ESM-only since v0.4.0.
fix
Use import statement or dynamic import() instead of require().
error:0308010C:digital envelope routines::unsupported
Node.js version mismatch or OpenSSL issues? Possibly running older Node.
fix
Ensure Node.js >= 22.
Could not connect to server: Connection refused
Tunnel server not running or wrong WebSocket URL.
fix
Start server: 'cactus-tunnel server' and verify port 7800 is open.
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
cactus-tunnel — npm install cactus-tunnel · libregistry