{"_id":"@antash-mishra/tunnel-client","name":"@antash-mishra/tunnel-client","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@antash-mishra/tunnel-client","version":"1.0.0","description":"Client for WebSocket tunnel server, allowing local server exposure.","main":"tunnel-client.js","bin":{"tunnel-client":"tunnel-client.js"},"scripts":{"start":"node tunnel-client.js"},"dependencies":{"ws":"^8.14.2","yargs":"^17.7.2"},"keywords":["tunnel","websocket","proxy","cli","local","expose"],"author":{"name":"Antash"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/antash-mishra/open-tunnel.git"},"bugs":{"url":"https://github.com/antash-mishra/open-tunnel/issues"},"homepage":"https://github.com/antash-mishra/open-tunnel/tree/main/client#readme","engines":{"node":">=14"},"_id":"@antash-mishra/tunnel-client@1.0.0","gitHead":"1599d7c5a7333f88fc8170ae1a2c3e99c8ce39bd","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-G5I/2AX9bGcf3LdPV9nVWnW+o4QKHK4b20aXI3rGM9W40wHa7aEc7TpBYlEe3WqbHn7cpdiZxWsgif5p2fX6sA==","shasum":"ee878fbf5eac4f45451e1c224a5166d0d9037af8","tarball":"https://registry.npmjs.org/@antash-mishra/tunnel-client/-/tunnel-client-1.0.0.tgz","fileCount":4,"unpackedSize":11835,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGSGGNrw548cak9nsqiZLyn+FvTetK5bDYvhi8WIphTCAiBK89/PnKedoUB/gAkfj9Feo2CTctwYghEBEaiIOekbbw=="}]},"_npmUser":{"name":"antash-mishra","email":"mishraantash34@gmail.com"},"directories":{},"maintainers":[{"name":"antash-mishra","email":"mishraantash34@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tunnel-client_1.0.0_1745075786753_0.16746299683964416"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-19T15:16:26.680Z","1.0.0":"2025-04-19T15:16:26.927Z","modified":"2025-04-19T15:16:27.200Z"},"maintainers":[{"name":"antash-mishra","email":"mishraantash34@gmail.com"}],"description":"Client for WebSocket tunnel server, allowing local server exposure.","homepage":"https://github.com/antash-mishra/open-tunnel/tree/main/client#readme","keywords":["tunnel","websocket","proxy","cli","local","expose"],"repository":{"type":"git","url":"git+https://github.com/antash-mishra/open-tunnel.git"},"author":{"name":"Antash"},"bugs":{"url":"https://github.com/antash-mishra/open-tunnel/issues"},"license":"MIT","readme":"# WebSocket Tunnel Client\n\nA simple, command-line WebSocket-based tunnel client that allows you to expose your local server to the internet through a tunnel server.\n\n[![NPM](https://img.shields.io/npm/v/websocket-tunnel-client.svg)](https://www.npmjs.com/package/websocket-tunnel-client) <!-- Optional: Add if publishing -->\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis tool connects to a compatible WebSocket tunnel server (like the one in the parent directory of this project) and forwards incoming public requests to a specified local server.\n\n## Features\n\n*   Expose any local HTTP/HTTPS server to a public URL.\n*   Connects via secure (WSS) or insecure (WS) WebSockets.\n*   Simple command-line interface.\n*   Automatic reconnection attempts on disconnect.\n*   Configurable tunnel server URL.\n\n## Installation\n\nInstall the client globally using npm:\n\n```bash\n# Option 1: Install directly from the source code (for development)\ncd client # Navigate to this directory\nnpm install -g .\n\n# Option 2: Install from NPM (if published)\n# npm install -g websocket-tunnel-client\n```\n\nThis installation makes the `tunnel-client` command available system-wide in your terminal.\n\n## Usage\n\nThe basic command structure is:\n\n```bash\ntunnel-client <local-server-url> [options]\n```\n\n**Arguments:**\n\n*   `<local-server-url>`: **Required**. The full URL of your local server that you want to expose. Include the protocol (`http` or `https`).\n    *   Example: `http://localhost:3000`\n    *   Example: `https://127.0.0.1:8443`\n\n**Options:**\n\n*   `-s, --server-url <url>`: The WebSocket URL (`ws://` or `wss://`) of the tunnel server to connect to. \n    *   Defaults to `ws://localhost:8080` (useful if running the server locally).\n    *   For a deployed server (e.g., on Fly.io), use its public WebSocket address like `wss://your-app-name.fly.dev`.\n*   `-h, --help`: Display help information and exit.\n\n**Examples:**\n\n1.  **Expose local server `http://localhost:5000` using the default tunnel server (`ws://localhost:8080`):**\n    ```bash\n    tunnel-client http://localhost:5000\n    ```\n\n2.  **Expose local server `http://127.0.0.1:8080` using a specific, deployed tunnel server:**\n    ```bash\n    tunnel-client http://127.0.0.1:8080 -s wss://my-tunnel-app.fly.dev\n    ```\n\n3.  **Expose a local HTTPS server:**\n    ```bash\n    tunnel-client https://localhost:8443\n    ```\n\nUpon successful connection, the client will print the assigned public URL.\n\n## How It Works\n\n1.  The `tunnel-client` CLI connects to the specified `--server-url` via WebSocket.\n2.  The tunnel server accepts the connection and assigns a unique Tunnel ID.\n3.  The client prints the public URL constructed from the server URL and the Tunnel ID (e.g., `https://my-tunnel-app.fly.dev/<tunnel-id>`).\n4.  When an HTTP request hits the public URL:\n    *   The tunnel server forwards the request details (method, path, headers, body) to the connected client over the WebSocket.\n    *   The `tunnel-client` receives the details and makes an equivalent HTTP/HTTPS request to your `<local-server-url>`.\n    *   The response from your local server (status, headers, body) is captured by the `tunnel-client`.\n    *   The client sends the response details back to the tunnel server over the WebSocket.\n    *   The tunnel server sends the HTTP response back to the original requester.\n\n## Development (Contributing)\n\n1.  Clone the main project repository.\n2.  Navigate to the client directory: `cd client`\n3.  Install development dependencies: `npm install`\n4.  Make your code changes in `tunnel-client.js`.\n5.  You can run the client directly during development without global installation:\n    ```bash\n    node tunnel-client.js http://localhost:3000 --server-url ws://localhost:8080\n    ```\n\n## License\n\n[MIT](LICENSE) <!-- Create a LICENSE file if you haven't -->\n\n## Running as a Service (Optional)\n\nFor persistent operation after global installation, you can use a process manager like PM2:\n\n```bash\npm2 start $(which tunnel-client) --name \"my-tunnel\" -- <local-server-url> [options]\n# Example:\npm2 start $(which tunnel-client) --name \"api-tunnel\" -- http://localhost:3001 -s wss://my-tunnel-server.com\n``` ","readmeFilename":"README.md","_rev":"1-194d64e9a52d29a0f9859b2e9279c768"}