@kvbox/cli 0.6.26 → 0.6.27

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/kvbox.js CHANGED
@@ -170,7 +170,7 @@ function versionOf(srcFileUrl, injected) {
170
170
  }
171
171
 
172
172
  // src/version.ts
173
- var VERSION = versionOf(import.meta.url, true ? "0.6.26" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.27" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
176
  import { Command as Command44 } from "commander";
@@ -468,6 +468,9 @@ function parseMib(text2) {
468
468
  return Number.isInteger(mib2) && mib2 > 0 ? mib2 : void 0;
469
469
  }
470
470
 
471
+ // ../shared/src/ranges.ts
472
+ var IPV4_RE = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
473
+
471
474
  // ../shared/src/api.ts
472
475
  var SizeSchema = z2.enum(SIZE_NAMES);
473
476
  var BOX_SSH_USER = "kvbox";
@@ -492,24 +495,24 @@ var PortsRequest = z2.object({
492
495
  keep: z2.boolean().optional()
493
496
  });
494
497
  var BoxPortSchema = z2.number().int().min(1).max(65535);
495
- var BoxLinkSchema = z2.object({ from: z2.string(), port: BoxPortSchema });
498
+ var BoxLinkSchema = z2.object({ from: z2.string(), port: BoxPortSchema, host: z2.string().optional() });
496
499
  var LinkRequest = z2.object({
497
500
  from: z2.string().min(1),
498
501
  fromOwner: z2.string().optional(),
499
502
  port: BoxPortSchema,
500
503
  /**
501
- * The box `from` is on another host (#207, a control plane's call only): no rule opens here. Its host
502
- * connects to this host's HTTPS listener (`BOX_LINK_PATH_RE`) with `key`, which this link alone answers to.
504
+ * The box `from` is on another host (#241, a control plane's call only): `host` by name, where its address
505
+ * is `ip`. This host cannot see that box, so the control plane says its address; the host takes one only
506
+ * inside the range of that host, which it knows from the tunnel between them.
503
507
  */
504
- far: z2.object({ key: z2.string().min(32) }).optional()
508
+ far: z2.object({ ip: z2.string().regex(IPV4_RE), host: z2.string().min(1) }).optional()
505
509
  });
506
510
  var FarLinkRequest = z2.object({
507
511
  to: z2.string().min(1),
508
512
  toOwner: z2.string().optional(),
509
513
  port: BoxPortSchema,
510
- url: z2.string().url(),
511
- pin: z2.string().min(1),
512
- key: z2.string().min(32)
514
+ ip: z2.string().regex(IPV4_RE),
515
+ host: z2.string().min(1)
513
516
  });
514
517
  var FarUnlinkRequest = FarLinkRequest.pick({ to: true, toOwner: true, port: true });
515
518
  var ClaimSubdomainRequest = z2.object({ name: z2.string(), port: BoxPortSchema });
@@ -799,6 +802,11 @@ var MachineSchema = z2.object({
799
802
  volumes: z2.array(z2.object({ name: z2.string(), sizeGib: z2.number().int(), mountPath: z2.string() })).optional(),
800
803
  /** Boxes that may reach this one, each on one port (#98). Absent: none. */
801
804
  links: z2.array(BoxLinkSchema).optional(),
805
+ /**
806
+ * Boxes on other hosts this one reaches (#241), each on one port: `to` is named like a link's `from`,
807
+ * `host` is the host it is on. The other side of that box's `links` entry. Absent: none.
808
+ */
809
+ reaches: z2.array(z2.object({ to: z2.string(), port: BoxPortSchema, host: z2.string() })).optional(),
802
810
  /**
803
811
  * The integrations turned on for the box (#205, `github`): names only, the credential is fetched by the box
804
812
  * each time it is needed. Absent: none. A host before integrations never sends it.
@@ -1102,8 +1110,12 @@ var CapacitySchema = z2.object({
1102
1110
  fromBackup: z2.boolean().optional(),
1103
1111
  /** True on a kvbox-server that keeps a box's `integrations` (#205); an older one drops the field without a word. */
1104
1112
  integrations: z2.boolean().optional(),
1105
- /** True on a kvbox-server that carries a link to a box on another host (#207); the control plane links across hosts only between two such. */
1106
- farLinks: z2.boolean().optional(),
1113
+ /**
1114
+ * The other hosts this one has a tunnel to, by name (#241): what its network carries a link across hosts to.
1115
+ * The control plane links two boxes on different hosts only when each host names the other. Absent on a
1116
+ * host without the tunnel (an older kvbox-server, a root step not run, no box range).
1117
+ */
1118
+ mesh: z2.array(z2.string()).optional(),
1107
1119
  /** True on a host whose network puts the boxes of one cluster in reach of each other (#215); the control plane places a cluster's box only on such a host. */
1108
1120
  clusters: z2.boolean().optional(),
1109
1121
  /** The integrations this kvbox-server knows (`hostKnowsIntegrations`). Absent with `integrations`: the first one's, `github` alone. */
@@ -1623,6 +1635,18 @@ var HostSshCaResponseSchema = z2.object({
1623
1635
  var HostRangeResponseSchema = z2.object({
1624
1636
  range: z2.string().nullable()
1625
1637
  });
1638
+ var HOST_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/;
1639
+ var MeshPeerSchema = z2.object({
1640
+ name: z2.string().regex(HOST_NAME_RE),
1641
+ publicKey: z2.string().regex(/^[A-Za-z0-9+/]{43}=$/),
1642
+ endpoint: z2.string().regex(/^[0-9a-zA-Z.-]+:\d{1,5}$/),
1643
+ range: z2.string()
1644
+ });
1645
+ var MeshRegisterRequest = z2.object({
1646
+ publicKey: MeshPeerSchema.shape.publicKey,
1647
+ port: z2.number().int().min(1).max(65535)
1648
+ });
1649
+ var MeshResponseSchema = z2.object({ peers: z2.array(MeshPeerSchema) });
1626
1650
  var CloudCaSchema = z2.object({
1627
1651
  controlPlane: z2.string(),
1628
1652
  publicKey: z2.string(),
@@ -1647,7 +1671,7 @@ var TrustCaReportSchema = z2.object({
1647
1671
  });
1648
1672
  var HostJoinRequestSchema = z2.object({
1649
1673
  token: z2.string().min(1),
1650
- name: z2.string().min(1),
1674
+ name: z2.string().regex(HOST_NAME_RE, "a host name is letters, digits, '.', '_' and '-', at most 63"),
1651
1675
  url: z2.string().url(),
1652
1676
  fingerprint: z2.string().regex(/^([0-9A-F]{2}:){31}[0-9A-F]{2}$/),
1653
1677
  publicAddress: z2.string().min(1),