asyx 0.2.4 → 0.3.0

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/README.md CHANGED
@@ -81,12 +81,42 @@ That's it! No firewall configuration, no port forwarding, no DNS setup. The `--m
81
81
  - Uses Asyx binary framing over WebSocket (no user action needed; handled automatically).
82
82
  - The relay URL in assignments uses `/tcp` endpoint (configured automatically).
83
83
 
84
+ **UDP tunnel (for UDP-based services):**
85
+ ```bash
86
+ asyx tunnel --udp --port 9000 # Coordinator assigns public port
87
+ asyx tunnel --udp --port 9000 --external-port 10010 # Request a specific port in your block
88
+ ```
89
+ - Creates a UDP tunnel for UDP-based services (e.g., game servers, real-time applications).
90
+ - `--port`: Your local app's UDP listening port (required).
91
+ - `--external-port`: Optional public port assignment; must be inside your tenant's 10-port block; otherwise the request is rejected.
92
+ - Targets are loopback-only; the CLI and relay enforce this automatically.
93
+ - CLI never binds your app's port; it uses an ephemeral socket and forwards to your existing local server.
94
+ - Output shows both FQDN and `FQDN:publicPort`. Point your external client at that public endpoint; traffic is forwarded to your local app on loopback.
95
+ - Uses secure binary framing over WebSocket (`udpWs-v1`) for efficient UDP datagram forwarding.
96
+ - Reuses the same MQTT/JWT control plane as TCP; no extra setup needed.
97
+
84
98
  3. **Clean up (optional)**
85
99
  ```bash
86
100
  rm -rf ~/.asyx/certs/<clientId>
87
101
  ```
88
102
  Removes local device material; re-run `asyx setup` afterwards to restore access.
89
103
 
104
+ ## What's New in v0.3.0
105
+
106
+ ### UDP Tunnels
107
+
108
+ Support for UDP tunnels alongside HTTP and TCP:
109
+ - **Same command shape as TCP**: `--port` is your app's local port; optional `--external-port` requests a specific public port from your assigned block.
110
+ - **Loopback-only targets**: Targets are loopback-only; the CLI and relay enforce this automatically.
111
+ - **CLI never binds your app's port**: It forwards to your existing local server using an ephemeral socket.
112
+ - **Production-ready**: Full backend infrastructure is complete and validated.
113
+
114
+ ### Enhanced Protocol Support
115
+
116
+ The CLI now supports HTTP, TCP, and UDP tunnels, giving you flexibility to expose any type of service through Asyx's secure relay infrastructure.
117
+
118
+ > **Note**: Version 0.3.0 is currently in development and will be published once the full feature set is complete and validated. The backend infrastructure is production-ready, and we're finalizing the remaining components before public release.
119
+
90
120
  ## What's New in v0.2.3
91
121
 
92
122
  - **Minecraft tunnels made easy**: New `--minecraft` verb—just run `asyx tunnel --minecraft` and share your server instantly. No port numbers, no configuration, no hassle.
@@ -102,7 +132,7 @@ That's it! No firewall configuration, no port forwarding, no DNS setup. The `--m
102
132
  - **Hardware attestation without PII** – The CLI derives a hashed hardware fingerprint locally using the safe `hw-fingerprint` fields; raw hardware attributes never leave the device.
103
133
  - **Resilient control plane** – Automatic JWT refresh via the background messaging queue, bounded reconnects, and observable logging (`ASYX_DEBUG=1`) keep tunnels stable during long soaks.
104
134
  - **Zero manual relay config** – Asyx backend assignments route traffic for you; no hostnames, firewall poking, or manual DNS updates required.
105
- - **Multi-protocol support** – HTTP and TCP tunnels share the same assignment system; choose the protocol that fits your service.
135
+ - **Multi-protocol support** – HTTP, TCP, and UDP tunnels share the same assignment system; choose the protocol that fits your service.
106
136
  - **Secure proxy architecture** – Forward-only mode avoids local port binding conflicts and keeps user services isolated from the CLI process.
107
137
  - **Observability-first UX** – Friendly error messages, deterministic exit codes, and optional debug traces make support straightforward.
108
138
  - **Future-ready auth** – Today's magic-link flow will extend to tunnel sharing with Asyx Quickpass, delivering passwordless approvals for downstream users.
@@ -115,6 +145,7 @@ asyx tunnel --http --port <n> # Start HTTP tunnel for local port <n>
115
145
  asyx tunnel --minecraft # Start Minecraft tunnel (easiest way!)
116
146
  asyx tunnel --minecraft --name <svc> # Start Minecraft tunnel with custom name
117
147
  asyx tunnel --tcp --port <n> [--name <service>] # Start TCP tunnel for local port <n>
148
+ asyx tunnel --udp --port <n> [--external-port <p>] # Start UDP tunnel for local port <n> (v0.3.0+)
118
149
  ```
119
150
 
120
151
  Use `asyx help` or `asyx <command> --help` for details.
@@ -191,6 +222,53 @@ asyx tunnel --minecraft --name my-server
191
222
 
192
223
  Future TCP guard/securing features are planned but out of scope for v4.1.
193
224
 
225
+ ## UDP Tunnels
226
+
227
+ UDP tunnels allow you to expose UDP-based services (game servers, real-time applications, custom protocols) through Asyx's secure relay infrastructure.
228
+
229
+ ### Quick Start (UDP)
230
+
231
+ ```bash
232
+ # Install (example)
233
+ npm install -g asyx
234
+
235
+ # Run a UDP app locally on 127.0.0.1:9000, then:
236
+ asyx tunnel --udp --port 9000 # Coordinator assigns public port
237
+ asyx tunnel --udp --port 9000 --external-port 10010 # Request a specific port in your block
238
+ ```
239
+
240
+ Output shows both FQDN and `FQDN:publicPort`. Point your external client at that public endpoint; traffic is forwarded to your local app on loopback.
241
+
242
+ ### Command Reference (UDP)
243
+
244
+ - `--port <targetPort>` (required): Your local app's UDP listening port.
245
+ - `--external-port <publicPort>` (optional): Must be inside your tenant's 10-port block; otherwise the request is rejected.
246
+
247
+ Targets are loopback-only; the CLI and relay enforce this automatically.
248
+
249
+ Reuses the same MQTT/JWT control plane as TCP; no extra setup needed.
250
+
251
+ ### Behavior Guarantees
252
+
253
+ - **Loopback only**: Targets are loopback-only; the CLI and relay enforce this automatically.
254
+ - **Your app keeps the port**: The CLI binds an ephemeral socket and forwards to your app's port; you don't stop or move your server.
255
+ - **Refresh/renewal**: Leases refresh automatically (same pattern as TCP).
256
+ - **Errors you may see**:
257
+ - `UDP_EXTERNAL_PORT_OUT_OF_BLOCK`: The requested `--external-port` is outside your tenant's assigned port block.
258
+ - `UDP_RELAY_UNAVAILABLE`: The relay isn't reachable or the WebSocket connection failed.
259
+
260
+ ### Minimal Examples
261
+
262
+ Forward a local game server on 25565:
263
+ ```bash
264
+ asyx tunnel --udp --port 25565
265
+ ```
266
+
267
+ Request a specific public port (in your block):
268
+ ```bash
269
+ asyx tunnel --udp --port 25565 --external-port <blockPort>
270
+ ```
271
+
194
272
  ## Troubleshooting
195
273
 
196
274
  ### TCP Tunnel Issues
@@ -208,6 +286,28 @@ Future TCP guard/securing features are planned but out of scope for v4.1.
208
286
  - The relay must have the `publicPort` open in its security group/firewall rules.
209
287
  - Verify the relay is operational and the TCP tunnel is active (check CLI logs).
210
288
 
289
+ ### UDP Tunnel Issues
290
+
291
+ **UDP_EXTERNAL_PORT_OUT_OF_BLOCK:**
292
+ - The requested `--external-port` is outside your tenant's assigned 10-port block.
293
+ - Check your tenant's port block assignment and use a port within that range.
294
+ - If you don't specify `--external-port`, the Coordinator automatically assigns an available port.
295
+
296
+ **UDP_RELAY_UNAVAILABLE:**
297
+ - The relay isn't reachable or the WebSocket connection failed.
298
+ - Check network connectivity and verify the relay is operational.
299
+ - Review CLI logs for connection errors or WebSocket handshake failures.
300
+
301
+ **Local service not receiving packets:**
302
+ - Ensure your local UDP service is running and listening on `127.0.0.1:<port>` (or the `--target-host` you specified).
303
+ - The CLI uses an ephemeral socket and forwards to your app's port; your app must be listening before starting the tunnel.
304
+ - Verify the tunnel is active and the WebSocket connection is established (check CLI output for "UDP tunnel active").
305
+
306
+ **Packets not reaching the relay:**
307
+ - Verify the relay's security group allows UDP traffic on the assigned port range (typically 10000-32000).
308
+ - Check if the relay host has a local firewall (e.g., UFW) that might be blocking UDP traffic.
309
+ - Ensure both AWS Security Group and host-level firewall rules allow UDP on the public port.
310
+
211
311
  ### MQTT Connection Issues (Windows)
212
312
 
213
313
  If you experience issues where the CLI connects but never receives `open_ack` messages (especially on Windows after running `asyx setup` without OpenSSL), the private key may be in PKCS#8 format which Node's TLS stack on Windows rejects.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asyx",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "Asyx Command Line Interface",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "relay"
21
21
  ],
22
22
  "bin": {
23
- "asyx": "./bin/asyx.js"
23
+ "asyx": "bin/asyx.js"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=18.17"
@@ -35,6 +35,7 @@
35
35
  "src/commands/setup.js",
36
36
  "src/commands/sts.js",
37
37
  "src/commands/tunnel.js",
38
+ "src/commands/validate-target-host.js",
38
39
  "src/control-plane/MqttControlPlaneClient.js",
39
40
  "src/control-plane/MqttControlPlaneTransport.js",
40
41
  "src/lib/.gitkeep",
@@ -43,6 +44,7 @@
43
44
  "src/lib/device.js",
44
45
  "src/lib/fingerprint.js",
45
46
  "src/lib/ids.js",
47
+ "src/lib/jwt-verifier.js",
46
48
  "src/lib/logger.js",
47
49
  "src/lib/pairing.js",
48
50
  "src/lib/shared-transport.js",
@@ -53,10 +55,13 @@
53
55
  "src/mqtt/events/schemas.js",
54
56
  "src/mqtt/ingress.js",
55
57
  "src/state/assignment.js",
58
+ "src/state/instance-registry.js",
56
59
  "src/tcp-v1/framing.js",
57
60
  "src/tunnel/http-tunnel.js",
58
61
  "src/tunnel/tcp-tunnel.js",
62
+ "src/tunnel/udp-tunnel.js",
59
63
  "src/tunnel/ws-control.js",
64
+ "src/udp-v1/framing.js",
60
65
  "LICENSE",
61
66
  "README.md",
62
67
  "SECURITY.md"
@@ -70,6 +75,7 @@
70
75
  "asyx": "^0.1.3",
71
76
  "chalk": "^5.3.0",
72
77
  "hw-fingerprint": "^3.2.0",
78
+ "jose": "^5.10.0",
73
79
  "node-fetch": "^3.3.2",
74
80
  "open": "^9.1.0",
75
81
  "ulid": "^2.4.0",
@@ -81,8 +87,9 @@
81
87
  "postinstall": "node -e \"console.log('✅ asyx installed')\"",
82
88
  "check": "node ./src/main.js --version",
83
89
  "test": "NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=8192\" jest --runInBand",
90
+ "test:ci": "NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=8192\" jest --runInBand --forceExit",
84
91
  "pack:verify": "node scripts/pack-verify.mjs",
85
- "prepublishOnly": "npm test && npm run pack:verify",
92
+ "prepublishOnly": "npm run test:ci && npm run pack:verify",
86
93
  "prepack": "node scripts/prepack.mjs",
87
94
  "postpack": "node scripts/postpack.mjs"
88
95
  },