Skip to content

WebSocket persistent TCP port forwarding command-line client

License

Notifications You must be signed in to change notification settings

peterkuma/wstcp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wstcp-client

WebSocket TCP forwarding command-line client.

wstcp is a client and server implementation of TCP forwarding over WebSocket. wstcp supports local and remote port forwarding, similar to OpenSSH.

Also see wstcp-server.

Diagram

Install

npm install wstcp-client

wstcp-client program will be installed in the bin directory.

Windows

Install as a Windows service:

npm install -g node-windows
npm run winservice_install

Uninstall

Windows

Uninstall the Windows service:

npm run winservice_uninstall

Usage

Run from console:

wstcp-client config.json

where config.json is a config file (see below).

Example

config.json:

{
  "server": "ws://localhost:10000",
  "log": "wstcp-client.log",
  "name": "client-1",
  "key": "1234",
  "port": 22,
  "remote": true
}

will connect to a wstcp-server running on ws://localhost:10000, login as client-1 with key 1234, and start listening on port 22 for incoming TCP connections. Connections will be forwarded to the wstcp-server, which decides where to route them depending on its configuration.

Configuration

Options:

  • server: Server URL (required).
  • log: Log file path (default: none).
  • name: Client name.
  • key: Client authentication key.
  • port: TCP forwarding port (required).
  • hostname: TCP forwarding hostname (required).
  • remote: Remote TCP forwarding (default: false).
  • retry: Retry failed connections (default: true).
  • retryInterval: Retry interval in ms (default: 10000).

Remote forwarding (remote: true) means wstcp-client listens for incoming TCP connections and forwards them to wstcp-server. Local forwarding (remote: false) means incoming TCP connections are forwarded from wstcp-server to wstcp-client.

Changelog

1.0.1 (2024-03-31)

  • Add hostname option.
  • Require new version of wstcp.
  • Improve documentation.

1.0.0 (2019-11-05)

  • Initial release.

License

MIT