asyx 0.1.3 → 0.2.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
@@ -34,13 +34,51 @@ npm uninstall -g asyx
34
34
  - Captures a minimal hardware fingerprint, hashes it locally (SHA-256 with public salt), and shares only the hash so the Asyx backend can verify the CLI is on the authorized device.
35
35
  - Certificates are single-device: copying them to another machine fails policy checks, so re-run `asyx setup` on every host.
36
36
 
37
+ ### 🎮 Sharing Your Minecraft Server (Super Easy!)
38
+
39
+ Want to share your Minecraft server with friends? It's literally one command:
40
+
41
+ ```bash
42
+ # 1. Start your local Minecraft server (on port 25565)
43
+ # 2. Run this:
44
+ asyx tunnel --minecraft
45
+
46
+ # 3. Share the hostname shown (e.g., smart.tunnel.asyx.ai)
47
+ # Your friends connect using just the hostname—no port needed!
48
+ ```
49
+
50
+ That's it! No firewall configuration, no port forwarding, no DNS setup. The `--minecraft` verb handles everything automatically, including creating the SRV record that lets Minecraft clients discover the port automatically.
51
+
37
52
  2. **Open a tunnel**
53
+
54
+ **HTTP tunnel:**
38
55
  ```bash
39
56
  asyx tunnel --http --port 3000
40
57
  ```
41
- - Creates a forward-only HTTP tunnel bound to your issued client ID.
42
- - Automatically refreshes JWTs over the Asyx messaging pipeline and keeps the session alive while traffic is flowing.
43
- - HTTP tunneling is the only supported protocol in this release; TCP access is planned for a future update.
58
+ - Creates a forward-only HTTP tunnel bound to your issued client ID.
59
+ - Automatically refreshes JWTs over the Asyx messaging pipeline and keeps the session alive while traffic is flowing.
60
+
61
+ **Minecraft tunnel (easiest way to share your server):**
62
+ ```bash
63
+ asyx tunnel --minecraft
64
+ ```
65
+ - **One command** to expose your local Minecraft server to the internet.
66
+ - Automatically configures port 25565 (override with `--port` if needed).
67
+ - Creates an SRV record so players can connect using just the hostname—**no port number needed**.
68
+ - **Example**: Run `asyx tunnel --minecraft`, then share `smart.tunnel.asyx.ai` with your friends. They connect in Minecraft using just that hostname.
69
+ - Optional `--name` flag for a custom subdomain (e.g., `--name my-server` → `my-server.smart.tunnel.asyx.ai`).
70
+ - That's it! No firewall rules, no port forwarding, no DNS configuration.
71
+
72
+ **TCP tunnel (for other services):**
73
+ ```bash
74
+ asyx tunnel --tcp --port <localPort> [--name <service>]
75
+ ```
76
+ - Creates a TCP tunnel for raw TCP connections (e.g., game servers, databases, SSH).
77
+ - `--port`: Local target port on `127.0.0.1` (e.g., `25565` for Minecraft on `127.0.0.1:25565`).
78
+ - `--name`: Optional service name; if provided, creates a CNAME alias `<name>.<subdomain>.tunnel.asyx.ai`; otherwise only `host:port` form is used.
79
+ - The CLI prints the assignment: `fqdn:publicPort` (alias if `--name` provided, otherwise `host:port`).
80
+ - Uses binary `tcp-v1` framing protocol over WebSocket (no user action needed; handled automatically).
81
+ - The relay URL in assignments uses `/tcp` endpoint (configured automatically).
44
82
 
45
83
  3. **Clean up (optional)**
46
84
  ```bash
@@ -48,22 +86,35 @@ npm uninstall -g asyx
48
86
  ```
49
87
  Removes local device material; re-run `asyx setup` afterwards to restore access.
50
88
 
89
+ ## What's New in v0.2.0
90
+
91
+ - **Minecraft tunnels made easy**: New `--minecraft` verb—just run `asyx tunnel --minecraft` and share your server instantly. No port numbers, no configuration, no hassle.
92
+ - **SRV record support**: Minecraft clients automatically discover the correct port via DNS SRV records—players just enter the hostname.
93
+ - **TCP tunnel support**: Expose raw TCP services (game servers, databases, SSH) with `asyx tunnel --tcp --port <n>`
94
+ - **Binary tcp-v1 framing**: Automatic protocol handling for multi-stream TCP tunneling
95
+ - **Coordinator-based assignments**: TCP tunnels use the same assignment system as HTTP tunnels; no additional configuration needed
96
+ - **Service aliases**: Optional `--name` flag for friendly service names (when aliases are provisioned)
97
+
51
98
  ## Why Asyx
52
99
 
53
100
  - **Device-bound identity** – Every `setup` run issues a unique certificate and uuLID. Asyx backend policies reject duplicate usage, preventing credential theft or relocation.
54
101
  - **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.
55
102
  - **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.
56
103
  - **Zero manual relay config** – Asyx backend assignments route traffic for you; no hostnames, firewall poking, or manual DNS updates required.
57
- - **Secure HTTP proxy** – Forward-only mode avoids local port binding conflicts and keeps user services isolated from the CLI process.
104
+ - **Multi-protocol support** – HTTP and TCP tunnels share the same assignment system; choose the protocol that fits your service.
105
+ - **Secure proxy architecture** – Forward-only mode avoids local port binding conflicts and keeps user services isolated from the CLI process.
58
106
  - **Observability-first UX** – Friendly error messages, deterministic exit codes, and optional debug traces make support straightforward.
59
- - **Future-ready auth** – Today’s magic-link flow will extend to tunnel sharing with Asyx Quickpass, delivering passwordless approvals for downstream users.
107
+ - **Future-ready auth** – Today's magic-link flow will extend to tunnel sharing with Asyx Quickpass, delivering passwordless approvals for downstream users.
60
108
 
61
109
  ## Command Reference
62
110
 
63
111
  ```bash
64
- asyx setup # Provision device certificate and client identity
65
- asyx tunnel --http --port <n> # Start HTTP tunnel for local port <n>
66
- asyx mqtt ... # Development MQTT utilities (NODE_ENV=dev)
112
+ asyx setup # Provision device certificate and client identity
113
+ asyx tunnel --http --port <n> # Start HTTP tunnel for local port <n>
114
+ asyx tunnel --minecraft # Start Minecraft tunnel (easiest way!)
115
+ asyx tunnel --minecraft --name <svc> # Start Minecraft tunnel with custom name
116
+ asyx tunnel --tcp --port <n> [--name <service>] # Start TCP tunnel for local port <n>
117
+ asyx mqtt ... # Development MQTT utilities (NODE_ENV=dev)
67
118
  ```
68
119
 
69
120
  Use `asyx help` or `asyx <command> --help` for details.
@@ -120,8 +171,71 @@ The CLI manages heartbeats automatically to keep idle sessions stable without us
120
171
  - Heartbeat stops when the tunnel exits or errors.
121
172
  - Use `ASYX_DEBUG=1` if you need to trace heartbeat activity for support purposes.
122
173
 
174
+ ## Security Groups
175
+
176
+ ### HTTP Tunnels with `--secgroup`
177
+
178
+ HTTP tunnels support per-guest authentication via Asyx Quickpass security groups. When you specify `--secgroup <slug>`, the tunnel enforces access control so only authorized guests (with valid Quickpass cookies) can access your service.
179
+
180
+ ### TCP Tunnels
181
+
182
+ TCP tunnels in v4.1 do not enforce per-guest authentication. Access is owner-only via JWT validation; guests connecting to the public port are anonymous (no per-connection auth). TCP tunnels honor relay-level limits:
183
+
184
+ **Minecraft Tunnels (v0.2.0+):**
185
+
186
+ The `--minecraft` verb makes sharing your Minecraft server incredibly simple:
187
+
188
+ ```bash
189
+ # Start your server, then run:
190
+ asyx tunnel --minecraft
191
+
192
+ # Share the hostname with friends (no port needed!)
193
+ # Example: smart.tunnel.asyx.ai
194
+ ```
195
+
196
+ **How it works:**
197
+ - Asyx automatically provisions an SRV record (`_minecraft._tcp.<host>`) that tells Minecraft clients which port to use
198
+ - Players enter just the hostname in the Minecraft launcher—no port number required
199
+ - The Minecraft launcher automatically discovers the port via the SRV record
200
+
201
+ **With a custom name:**
202
+ ```bash
203
+ asyx tunnel --minecraft --name my-server
204
+ # Share: my-server.smart.tunnel.asyx.ai
205
+ ```
206
+
207
+ **Technical details:**
208
+ - **SRV-aware clients (Minecraft)**: Use the hostname directly (with or without `--name`). The Minecraft launcher automatically discovers the port via the SRV record.
209
+ - **Non-SRV-aware clients**: Use the `hostname:port` format (e.g., `smart.tunnel.asyx.ai:10000`).
210
+ - **SRV record format**: `_minecraft._tcp.<host>` → target `<fqdn>`, port `<publicPort>`
211
+ - With `--name`: `_minecraft._tcp.<name>.<subdomain>.tunnel.asyx.ai`
212
+ - Without `--name`: `_minecraft._tcp.<subdomain>.tunnel.asyx.ai`
213
+ - **TTL**: 60 seconds (low TTL for agility)
214
+ - **Best-effort design**: SRV provisioning failures don't block tunnel creation; the tunnel still works with `hostname:port` format.
215
+ - **No default alias**: CNAME aliases are only created if you provide `--name`.
216
+ - **Connection limits**: Maximum concurrent connections per lease
217
+ - **Rate limits**: Bandwidth and connection rate throttling
218
+ - **Idle timeouts**: Automatic connection closure after inactivity
219
+
220
+ Future TCP guard/securing features are planned but out of scope for v4.1.
221
+
123
222
  ## Troubleshooting
124
223
 
224
+ ### TCP Tunnel Issues
225
+
226
+ **Alias unavailable:**
227
+ - If the Coordinator returns a warning that an alias is unavailable, use the `fqdn:publicPort` format shown in the CLI output.
228
+ - This is normal during validation phases; `host:port` always works.
229
+
230
+ **Local service not accessible:**
231
+ - Ensure your local service is running on `127.0.0.1:<port>` on the CLI machine.
232
+ - The tunnel forwards connections from the relay to `127.0.0.1:<localPort>`.
233
+
234
+ **Connection timeouts:**
235
+ - If external connections to `fqdn:publicPort` time out, check firewall/port exposure at the relay.
236
+ - The relay must have the `publicPort` open in its security group/firewall rules.
237
+ - Verify the relay is operational and the TCP tunnel is active (check CLI logs).
238
+
125
239
  ### MQTT Connection Issues (Windows)
126
240
 
127
241
  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.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Asyx Command Line Interface",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -53,7 +53,9 @@
53
53
  "src/mqtt/events/schemas.js",
54
54
  "src/mqtt/ingress.js",
55
55
  "src/state/assignment.js",
56
+ "src/tcp-v1/framing.js",
56
57
  "src/tunnel/http-tunnel.js",
58
+ "src/tunnel/tcp-tunnel.js",
57
59
  "src/tunnel/ws-control.js",
58
60
  "LICENSE",
59
61
  "README.md",
@@ -75,9 +77,10 @@
75
77
  "zod": "3.23.8"
76
78
  },
77
79
  "scripts": {
80
+ "build": "npm install",
78
81
  "postinstall": "node -e \"console.log('✅ asyx installed')\"",
79
82
  "check": "node ./src/main.js --version",
80
- "test": "NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
83
+ "test": "NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=8192\" jest --runInBand",
81
84
  "pack:verify": "node scripts/pack-verify.mjs",
82
85
  "prepublishOnly": "npm test && npm run pack:verify",
83
86
  "prepack": "node scripts/prepack.mjs",