asyx 0.9.1 → 0.9.2

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
@@ -256,6 +256,10 @@ asyx tunnel --minecraft --to <hostname> [--port <n>] [--name <alias>]
256
256
 
257
257
  ---
258
258
 
259
+ ## What's new in 0.9.2
260
+
261
+ **Minecraft records follow a moved port** — when a TCP port moves to another of your addresses (`--to slow.tunnel.asyx.ai --external-port 10000`), its Minecraft record moves too, and the CLI says so: `Minecraft players now find it at slow.tunnel.asyx.ai.` If the new address already has a Minecraft record for another port, that one stays and the CLI tells you.
262
+
259
263
  ## What's new in 0.9.1
260
264
 
261
265
  **The live line names your public address** — an HTTP tunnel now prints `Tunnel live at https://<your address>` and then `Forwarding to http://localhost:<port>`, instead of only the local address.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asyx",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Asyx tunnel CLI — secure localhost exposure (HTTP, TCP, UDP)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -771,6 +771,8 @@ async function tcpTunnel(localPort, serviceName, kind = null, requestedExternalP
771
771
  handle.on('assigned', ({ tcpAliasFqdn, srvProvisioned, srvFqdn, fqdn, publicPort, aliasRequestedButFailed, portMoved }) => {
772
772
  // Story 2.11 c3: naming a port labelled for another address moved its label here
773
773
  if (portMoved?.from) process.stdout.write(`Port ${portMoved.port} moved from ${portMoved.from} to ${portMoved.to}.\n`);
774
+ const mc = minecraftMoveLine(portMoved); // Story 1.7 r8
775
+ if (mc) process.stdout.write(mc);
774
776
  if (tcpAliasFqdn) {
775
777
  process.stdout.write(`Your TCP server is available at:\n\n`);
776
778
  process.stdout.write(` ${tcpAliasFqdn}\n`);
@@ -992,3 +994,18 @@ export function httpLiveLines(assignment, localPort) {
992
994
  ? `🌐 Tunnel live at https://${publicHost}\n Forwarding to http://localhost:${localPort}\n`
993
995
  : `🌐 Tunnel live at http://localhost:${localPort}\n`;
994
996
  }
997
+
998
+ /** Story 1.7 r8: what happened to the port's Minecraft record when its label moved (TCP). */
999
+ export function minecraftMoveLine(portMoved) {
1000
+ const m = portMoved?.minecraft;
1001
+ if (!portMoved?.from || !m) return '';
1002
+ const to = portMoved.toHostname || portMoved.to;
1003
+ const from = portMoved.fromHostname || portMoved.from;
1004
+ switch (m.status) {
1005
+ case 'moved': return `Minecraft players now find it at ${to}. For a few minutes ${from} may still lead there.\n`;
1006
+ case 'kept_existing': return `${to} already points Minecraft players at port ${m.existingPort}, so that stays. The Minecraft record for port ${portMoved.port} under ${from} was removed.\n`;
1007
+ case 'pending': return `The Minecraft record is not updated yet; it follows within a few minutes.\n`;
1008
+ case 'not_updated': return `The Minecraft record for port ${portMoved.port} could not be moved to ${to}. Players can still connect with ${to}:${portMoved.port}.\n`;
1009
+ default: return '';
1010
+ }
1011
+ }
@@ -35,6 +35,13 @@ export type TcpAssignedEvent = {
35
35
  kind: string;
36
36
  from: string;
37
37
  to: string;
38
+ fromHostname?: string | null;
39
+ toHostname?: string | null;
40
+ /** Story 1.7 r8: what happened to the port's Minecraft record */
41
+ minecraft?: {
42
+ status: 'moved' | 'nothing' | 'kept_existing' | 'pending' | 'not_updated';
43
+ existingPort?: number | null;
44
+ } | null;
38
45
  } | null;
39
46
  };
40
47
  /** What open() resolves to and the 'live' state carries. */