@camstack/addon-tailscale 1.2.117 → 1.2.119

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.
@@ -2,35 +2,13 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region \0rolldown/runtime.js
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
- key = keys[i];
15
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: ((k) => from[k]).bind(null, key),
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
- //#endregion
27
- const require_dist = require("../dist-jCCe7qVD.js");
5
+ const require_auth_key_file = require("../auth-key-file-Czokmvfx.js");
28
6
  let node_child_process = require("node:child_process");
29
7
  let node_util = require("node:util");
30
- let node_fs = require("node:fs");
31
- node_fs = __toESM(node_fs);
32
8
  let node_path = require("node:path");
33
- node_path = __toESM(node_path);
9
+ node_path = require_auth_key_file.__toESM(node_path);
10
+ let node_fs = require("node:fs");
11
+ node_fs = require_auth_key_file.__toESM(node_fs);
34
12
  //#region src/client/tailscale-cli.ts
35
13
  /**
36
14
  * Thin wrapper around the `tailscale` CLI.
@@ -190,19 +168,20 @@ var TailscaleCli = class {
190
168
  * while already joined returns immediately. */
191
169
  async up(input) {
192
170
  const bin = await this.resolveBin();
193
- const args = [
194
- "up",
195
- "--auth-key",
196
- input.authKey,
197
- "--reset"
198
- ];
199
- if (input.hostname) args.push(`--hostname=${input.hostname}`);
200
- try {
201
- await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
202
- } catch (err) {
203
- const e = err;
204
- throw new TailscaleCliError(`tailscale up failed: ${e.message}`, e.stderr ?? "");
205
- }
171
+ await require_auth_key_file.withAuthKeyFile(input.authKey, async (authKeyFlag) => {
172
+ const args = [
173
+ "up",
174
+ authKeyFlag,
175
+ "--reset"
176
+ ];
177
+ if (input.hostname) args.push(`--hostname=${input.hostname}`);
178
+ try {
179
+ await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
180
+ } catch (err) {
181
+ const e = err;
182
+ throw new TailscaleCliError(`tailscale up failed: ${require_auth_key_file.scrubSecret(e.message, input.authKey)}`, require_auth_key_file.scrubSecret(e.stderr ?? "", input.authKey));
183
+ }
184
+ });
206
185
  }
207
186
  /**
208
187
  * Start an interactive `tailscale up` (no `--auth-key`) and resolve
@@ -579,8 +558,8 @@ var DEFAULT_HUB_PORT = 4443;
579
558
  * The chain still stops at the cap, until a manual join (which resets the
580
559
  * counter) or an addon restart.
581
560
  */
582
- var AUTO_REJOIN_BACKOFF_MS = require_dist.BOOT_RECOVERY_BACKOFF_MS;
583
- var TailscaleClientAddon = class extends require_dist.BaseAddon {
561
+ var AUTO_REJOIN_BACKOFF_MS = require_auth_key_file.BOOT_RECOVERY_BACKOFF_MS;
562
+ var TailscaleClientAddon = class extends require_auth_key_file.BaseAddon {
584
563
  /**
585
564
  * The Tailscale CLI wrapper. `null` only in the degraded state where
586
565
  * the addon loaded but `clientMode: 'onboard'` failed to start its
@@ -700,10 +679,10 @@ var TailscaleClientAddon = class extends require_dist.BaseAddon {
700
679
  };
701
680
  const networkAccessProvider = this.buildNetworkAccessProvider();
702
681
  return [{
703
- capability: require_dist.meshNetworkCapability,
682
+ capability: require_auth_key_file.meshNetworkCapability,
704
683
  provider: meshProvider
705
684
  }, {
706
- capability: require_dist.networkAccessCapability,
685
+ capability: require_auth_key_file.networkAccessCapability,
707
686
  provider: networkAccessProvider
708
687
  }];
709
688
  }
@@ -912,7 +891,7 @@ var TailscaleClientAddon = class extends require_dist.BaseAddon {
912
891
  type: "addon",
913
892
  id: this.ctx.id
914
893
  },
915
- category: require_dist.EventCategory.MeshNetworkChanged,
894
+ category: require_auth_key_file.EventCategory.MeshNetworkChanged,
916
895
  data: {
917
896
  host,
918
897
  port,
@@ -1294,15 +1273,15 @@ var TailscaleClientAddon = class extends require_dist.BaseAddon {
1294
1273
  type: "boolean",
1295
1274
  key: "acceptRoutes",
1296
1275
  label: "Accept routes from peers",
1297
- description: "Install subnet routes other peers advertise (e.g. a peer router exposing `192.168.x.x/24`).",
1276
+ description: "Install subnet routes other peers advertise (e.g. a peer router exposing `192.168.60.0/24`).",
1298
1277
  default: false
1299
1278
  }),
1300
1279
  this.field({
1301
1280
  type: "text",
1302
1281
  key: "advertisedRoutes",
1303
1282
  label: "Advertise subnet routes",
1304
- description: "Comma-separated CIDRs this host exposes to peers (e.g. `192.168.x.x/24,10.x.x.x/8`). Requires approval in the Tailscale admin console.",
1305
- placeholder: "192.168.x.x/24"
1283
+ description: "Comma-separated CIDRs this host exposes to peers (e.g. `192.168.10.0/24,10.0.0.0/8`). Requires approval in the Tailscale admin console.",
1284
+ placeholder: "192.168.10.0/24"
1306
1285
  }),
1307
1286
  this.field({
1308
1287
  type: "text",
@@ -1,8 +1,8 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-DOnpd-Z8.mjs";
1
+ import { a as BOOT_RECOVERY_BACKOFF_MS, i as networkAccessCapability, n as withAuthKeyFile, o as BaseAddon, r as meshNetworkCapability, s as EventCategory, t as scrubSecret } from "../auth-key-file-CVMhmHD4.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
- import * as fs from "node:fs";
5
4
  import * as path from "node:path";
5
+ import * as fs from "node:fs";
6
6
  //#region src/client/tailscale-cli.ts
7
7
  /**
8
8
  * Thin wrapper around the `tailscale` CLI.
@@ -162,19 +162,20 @@ var TailscaleCli = class {
162
162
  * while already joined returns immediately. */
163
163
  async up(input) {
164
164
  const bin = await this.resolveBin();
165
- const args = [
166
- "up",
167
- "--auth-key",
168
- input.authKey,
169
- "--reset"
170
- ];
171
- if (input.hostname) args.push(`--hostname=${input.hostname}`);
172
- try {
173
- await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
174
- } catch (err) {
175
- const e = err;
176
- throw new TailscaleCliError(`tailscale up failed: ${e.message}`, e.stderr ?? "");
177
- }
165
+ await withAuthKeyFile(input.authKey, async (authKeyFlag) => {
166
+ const args = [
167
+ "up",
168
+ authKeyFlag,
169
+ "--reset"
170
+ ];
171
+ if (input.hostname) args.push(`--hostname=${input.hostname}`);
172
+ try {
173
+ await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
174
+ } catch (err) {
175
+ const e = err;
176
+ throw new TailscaleCliError(`tailscale up failed: ${scrubSecret(e.message, input.authKey)}`, scrubSecret(e.stderr ?? "", input.authKey));
177
+ }
178
+ });
178
179
  }
179
180
  /**
180
181
  * Start an interactive `tailscale up` (no `--auth-key`) and resolve
@@ -1266,15 +1267,15 @@ var TailscaleClientAddon = class extends BaseAddon {
1266
1267
  type: "boolean",
1267
1268
  key: "acceptRoutes",
1268
1269
  label: "Accept routes from peers",
1269
- description: "Install subnet routes other peers advertise (e.g. a peer router exposing `192.168.x.x/24`).",
1270
+ description: "Install subnet routes other peers advertise (e.g. a peer router exposing `192.168.60.0/24`).",
1270
1271
  default: false
1271
1272
  }),
1272
1273
  this.field({
1273
1274
  type: "text",
1274
1275
  key: "advertisedRoutes",
1275
1276
  label: "Advertise subnet routes",
1276
- description: "Comma-separated CIDRs this host exposes to peers (e.g. `192.168.x.x/24,10.x.x.x/8`). Requires approval in the Tailscale admin console.",
1277
- placeholder: "192.168.x.x/24"
1277
+ description: "Comma-separated CIDRs this host exposes to peers (e.g. `192.168.10.0/24,10.0.0.0/8`). Requires approval in the Tailscale admin console.",
1278
+ placeholder: "192.168.10.0/24"
1278
1279
  }),
1279
1280
  this.field({
1280
1281
  type: "text",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-jCCe7qVD.js");
5
+ const require_auth_key_file = require("../auth-key-file-Czokmvfx.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/ingress/tailscale-cli.ts
@@ -139,19 +139,20 @@ var TailscaleCli = class {
139
139
  * while already joined returns immediately. */
140
140
  async up(input) {
141
141
  const bin = await this.resolveBin();
142
- const args = [
143
- "up",
144
- "--auth-key",
145
- input.authKey,
146
- "--reset"
147
- ];
148
- if (input.hostname) args.push(`--hostname=${input.hostname}`);
149
- try {
150
- await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
151
- } catch (err) {
152
- const e = err;
153
- throw new TailscaleCliError(`tailscale up failed: ${e.message}`, e.stderr ?? "");
154
- }
142
+ await require_auth_key_file.withAuthKeyFile(input.authKey, async (authKeyFlag) => {
143
+ const args = [
144
+ "up",
145
+ authKeyFlag,
146
+ "--reset"
147
+ ];
148
+ if (input.hostname) args.push(`--hostname=${input.hostname}`);
149
+ try {
150
+ await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
151
+ } catch (err) {
152
+ const e = err;
153
+ throw new TailscaleCliError(`tailscale up failed: ${require_auth_key_file.scrubSecret(e.message, input.authKey)}`, require_auth_key_file.scrubSecret(e.stderr ?? "", input.authKey));
154
+ }
155
+ });
155
156
  }
156
157
  /** Leave the tailnet. After this the host's `100.x` address is
157
158
  * released until the next `up`. */
@@ -297,7 +298,7 @@ var DEFAULT_CONFIG = {
297
298
  targetPath: "",
298
299
  upstreamScheme: "https+insecure"
299
300
  };
300
- var TailscaleIngressAddon = class extends require_dist.BaseAddon {
301
+ var TailscaleIngressAddon = class extends require_auth_key_file.BaseAddon {
301
302
  cli;
302
303
  /**
303
304
  * Snapshot of the running ingress params so stop()/disposer can issue
@@ -326,7 +327,7 @@ var TailscaleIngressAddon = class extends require_dist.BaseAddon {
326
327
  };
327
328
  this.ctx.addDisposer(() => this.gracefulShutdown());
328
329
  return [{
329
- capability: require_dist.networkAccessCapability,
330
+ capability: require_auth_key_file.networkAccessCapability,
330
331
  provider
331
332
  }];
332
333
  }
@@ -379,7 +380,7 @@ var TailscaleIngressAddon = class extends require_dist.BaseAddon {
379
380
  type: "addon",
380
381
  id: this.ctx.id
381
382
  },
382
- category: require_dist.EventCategory.NetworkTunnelStarted,
383
+ category: require_auth_key_file.EventCategory.NetworkTunnelStarted,
383
384
  data: { url: endpoint.url }
384
385
  });
385
386
  return {
@@ -413,7 +414,7 @@ var TailscaleIngressAddon = class extends require_dist.BaseAddon {
413
414
  type: "addon",
414
415
  id: this.ctx.id
415
416
  },
416
- category: require_dist.EventCategory.NetworkTunnelStopped,
417
+ category: require_auth_key_file.EventCategory.NetworkTunnelStopped,
417
418
  data: {}
418
419
  });
419
420
  }
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-DOnpd-Z8.mjs";
1
+ import { i as networkAccessCapability, n as withAuthKeyFile, o as BaseAddon, s as EventCategory, t as scrubSecret } from "../auth-key-file-CVMhmHD4.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
@@ -136,19 +136,20 @@ var TailscaleCli = class {
136
136
  * while already joined returns immediately. */
137
137
  async up(input) {
138
138
  const bin = await this.resolveBin();
139
- const args = [
140
- "up",
141
- "--auth-key",
142
- input.authKey,
143
- "--reset"
144
- ];
145
- if (input.hostname) args.push(`--hostname=${input.hostname}`);
146
- try {
147
- await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
148
- } catch (err) {
149
- const e = err;
150
- throw new TailscaleCliError(`tailscale up failed: ${e.message}`, e.stderr ?? "");
151
- }
139
+ await withAuthKeyFile(input.authKey, async (authKeyFlag) => {
140
+ const args = [
141
+ "up",
142
+ authKeyFlag,
143
+ "--reset"
144
+ ];
145
+ if (input.hostname) args.push(`--hostname=${input.hostname}`);
146
+ try {
147
+ await execFileP(bin, this.withSocket(args), { timeout: 6e4 });
148
+ } catch (err) {
149
+ const e = err;
150
+ throw new TailscaleCliError(`tailscale up failed: ${scrubSecret(e.message, input.authKey)}`, scrubSecret(e.stderr ?? "", input.authKey));
151
+ }
152
+ });
152
153
  }
153
154
  /** Leave the tailnet. After this the host's `100.x` address is
154
155
  * released until the next `up`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-tailscale",
3
- "version": "1.2.117",
3
+ "version": "1.2.119",
4
4
  "description": "Tailscale bundle for CamStack — joins the host to a tailnet (client) and exposes the hub via Serve/Funnel (ingress). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",