traforo 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/client.js +7 -2
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { goke } from 'goke';
|
|
3
3
|
import { CLI_NAME, runTunnel, parseCommandFromArgv } from './run-tunnel.js';
|
|
4
4
|
const { command, argv } = parseCommandFromArgv(process.argv);
|
|
5
|
-
const cli =
|
|
5
|
+
const cli = goke(CLI_NAME);
|
|
6
6
|
cli
|
|
7
7
|
.command('', 'Expose a local port via tunnel')
|
|
8
8
|
.option('-p, --port <port>', 'Local port to expose (required)')
|
package/dist/client.js
CHANGED
|
@@ -201,9 +201,14 @@ export class TunnelClient {
|
|
|
201
201
|
const { localHost, localPort, localHttps } = this.options;
|
|
202
202
|
const protocol = localHttps ? 'wss' : 'ws';
|
|
203
203
|
const url = `${protocol}://${localHost}:${localPort}${msg.path}`;
|
|
204
|
-
|
|
204
|
+
// Forward WebSocket subprotocol if present (e.g. "vite-hmr")
|
|
205
|
+
const subprotocol = msg.headers['sec-websocket-protocol'];
|
|
206
|
+
const protocols = subprotocol
|
|
207
|
+
? subprotocol.split(',').map((p) => p.trim())
|
|
208
|
+
: undefined;
|
|
209
|
+
console.log(`WS OPEN ${msg.path} (${msg.connId})${protocols ? ` protocols=${protocols}` : ''}`);
|
|
205
210
|
try {
|
|
206
|
-
const localWs = new WebSocket(url);
|
|
211
|
+
const localWs = new WebSocket(url, protocols);
|
|
207
212
|
localWs.on('open', () => {
|
|
208
213
|
console.log(`WS CONNECTED ${msg.connId}`);
|
|
209
214
|
this.localWsConnections.set(msg.connId, localWs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "traforo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "HTTP tunnel via Cloudflare Durable Objects and WebSockets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"@types/ws": "^8.18.1",
|
|
35
35
|
"tsx": "^4.20.5",
|
|
36
36
|
"typescript": "^5.7.0",
|
|
37
|
+
"vite": "^7.1.4",
|
|
37
38
|
"vitest": "^3.2.4",
|
|
38
39
|
"wrangler": "^4.24.3"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"
|
|
42
|
+
"goke": "^6.1.2",
|
|
42
43
|
"string-dedent": "^3.0.2",
|
|
43
44
|
"ws": "^8.19.0"
|
|
44
45
|
},
|