traforo
v0.0.6
Published
HTTP tunnel via Cloudflare Durable Objects and WebSockets
Downloads
712
Readme
TRAFORO
HTTP tunnel via Cloudflare Durable Objects and WebSockets. Expose local servers to the internet with a simple CLI.
INSTALLATION
npm install -g traforoUSAGE
Expose a local server:
traforo -p 3000With a custom tunnel ID:
traforo -p 3000 -t my-appRun a command and tunnel it:
traforo -p 3000 -- next start
traforo -p 3000 -- pnpm dev
traforo -p 5173 -- viteThe tunnel URL will be:
https://{tunnel-id}-tunnel.traforo.devOPTIONS
-p, --port <port> Local port to expose (required)
-t, --tunnel-id [id] Tunnel ID (random if omitted)
-h, --host [host] Local host (default: localhost)
-s, --server [url] Custom tunnel server URL
--help Show help
--version Show versionHOW IT WORKS
- Local client connects to Cloudflare Durable Object via WebSocket
- HTTP requests to tunnel URL are forwarded to the DO
- DO sends requests over WebSocket to local client
- Local client makes request to localhost and returns response
- WebSocket connections from users are also proxied through
API ENDPOINTS
/traforo-status Check if tunnel is online
/traforo-upstream WebSocket endpoint for local client
/* All other paths proxied to local serverLIBRARY USAGE
import { TunnelClient } from 'traforo/client'
import { runTunnel } from 'traforo/run-tunnel'
const client = new TunnelClient({
localPort: 3000,
tunnelId: 'my-app',
})
await client.connect()LICENSE
MIT
