@impz/testing 7.11.0 → 7.12.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/dist/index.js +111 -40
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20136,6 +20136,7 @@ var PassStatusSchema = z34.object({
|
|
|
20136
20136
|
});
|
|
20137
20137
|
var HttpsInfoSchema = z34.object({
|
|
20138
20138
|
domain: z34.string(),
|
|
20139
|
+
apiHost: z34.string().optional(),
|
|
20139
20140
|
dnsToken: PassStatusSchema.nullable()
|
|
20140
20141
|
});
|
|
20141
20142
|
var PublicInfoSchema = z34.object({
|
|
@@ -21564,11 +21565,16 @@ function checkPublicPorts(ports, others, slotPorts) {
|
|
|
21564
21565
|
import { existsSync as existsSync2 } from "fs";
|
|
21565
21566
|
import * as z52 from "zod";
|
|
21566
21567
|
var LETS_ENCRYPT_DIRECTORY = "https://acme-v02.api.letsencrypt.org/directory";
|
|
21567
|
-
|
|
21568
|
+
function buildDomainSchema(setting, example) {
|
|
21569
|
+
return z52.string().transform((value) => value.toLowerCase().replace(/\.$/u, "")).pipe(z52.string().regex(/^(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?$/u, `${setting} must be a domain name such as ${example}`));
|
|
21570
|
+
}
|
|
21571
|
+
var DomainSchema = buildDomainSchema("IMP_DOMAIN", "imp.example.com");
|
|
21572
|
+
var ApiHostSchema = buildDomainSchema("IMP_API_HOST", "dash.imp.example.com");
|
|
21568
21573
|
var PortSchema2 = z52.coerce.number().pipe(z52.int().min(1).max(65535));
|
|
21569
21574
|
var DNS_PROVIDERS = ["cloudflare", "challtestsrv"];
|
|
21570
21575
|
var HttpsEnvSchema = z52.object({
|
|
21571
21576
|
IMP_DOMAIN: DomainSchema.optional(),
|
|
21577
|
+
IMP_API_HOST: ApiHostSchema.optional(),
|
|
21572
21578
|
IMP_HTTPS_PORT: PortSchema2.default(443),
|
|
21573
21579
|
IMP_HTTP_PORT: PortSchema2.default(80),
|
|
21574
21580
|
IMP_DNS_PROVIDER: z52.enum(DNS_PROVIDERS).optional(),
|
|
@@ -21588,6 +21594,9 @@ function readHttpsConfig(env) {
|
|
|
21588
21594
|
throw new Error("set IMP_DNS_API_TOKEN or IMP_DNS_API_TOKEN_FILE, not both");
|
|
21589
21595
|
}
|
|
21590
21596
|
if (env.IMP_DOMAIN === undefined) {
|
|
21597
|
+
if (env.IMP_API_HOST !== undefined) {
|
|
21598
|
+
throw new Error("IMP_API_HOST needs IMP_DOMAIN: it is one label below it");
|
|
21599
|
+
}
|
|
21591
21600
|
if (env.IMP_PUBLIC_IP !== undefined) {
|
|
21592
21601
|
throw new Error("IMP_PUBLIC_IP needs IMP_DOMAIN: public imps are served on it");
|
|
21593
21602
|
}
|
|
@@ -21596,6 +21605,9 @@ function readHttpsConfig(env) {
|
|
|
21596
21605
|
if (env.IMP_DNS_PROVIDER === undefined) {
|
|
21597
21606
|
throw new Error(`IMP_DOMAIN needs IMP_DNS_PROVIDER (${DNS_PROVIDERS.join(" or ")}) for its certificate`);
|
|
21598
21607
|
}
|
|
21608
|
+
if (env.IMP_API_HOST !== undefined && !isOneLabelBelow(env.IMP_API_HOST, env.IMP_DOMAIN)) {
|
|
21609
|
+
throw new Error(`IMP_API_HOST ${env.IMP_API_HOST} must be one label below IMP_DOMAIN, such as dash.${env.IMP_DOMAIN}, so the wildcard certificate covers it`);
|
|
21610
|
+
}
|
|
21599
21611
|
const token = findTokenSource(env);
|
|
21600
21612
|
if (env.IMP_DNS_PROVIDER === "cloudflare" && token === null) {
|
|
21601
21613
|
throw new Error("IMP_DNS_PROVIDER=cloudflare needs IMP_DNS_API_TOKEN or IMP_DNS_API_TOKEN_FILE");
|
|
@@ -21614,6 +21626,7 @@ function readHttpsConfig(env) {
|
|
|
21614
21626
|
}
|
|
21615
21627
|
return {
|
|
21616
21628
|
domain: env.IMP_DOMAIN,
|
|
21629
|
+
apiHost: env.IMP_API_HOST ?? env.IMP_DOMAIN,
|
|
21617
21630
|
httpsPort: env.IMP_HTTPS_PORT,
|
|
21618
21631
|
httpPort: env.IMP_HTTP_PORT,
|
|
21619
21632
|
dns: {
|
|
@@ -21631,6 +21644,9 @@ function readHttpsConfig(env) {
|
|
|
21631
21644
|
}
|
|
21632
21645
|
};
|
|
21633
21646
|
}
|
|
21647
|
+
function isOneLabelBelow(host, domain) {
|
|
21648
|
+
return host.endsWith(`.${domain}`) && !host.slice(0, -(domain.length + 1)).includes(".");
|
|
21649
|
+
}
|
|
21634
21650
|
var isUnreachable = buildRangeMatcher([
|
|
21635
21651
|
"10.0.0.0/8",
|
|
21636
21652
|
"100.64.0.0/10",
|
|
@@ -22161,7 +22177,7 @@ import { join as join49 } from "path";
|
|
|
22161
22177
|
// packages/daemon/package.json
|
|
22162
22178
|
var package_default = {
|
|
22163
22179
|
name: "@impz/daemon",
|
|
22164
|
-
version: "7.
|
|
22180
|
+
version: "7.12.0",
|
|
22165
22181
|
private: true,
|
|
22166
22182
|
description: "impd: the imp host daemon",
|
|
22167
22183
|
type: "module",
|
|
@@ -28422,6 +28438,7 @@ async function runRestore(deps, input) {
|
|
|
28422
28438
|
}
|
|
28423
28439
|
for (const imp of chosen) {
|
|
28424
28440
|
const name = input.as ?? imp.name;
|
|
28441
|
+
deps.imps.requireFreeName(name);
|
|
28425
28442
|
if (presentNames.has(name)) {
|
|
28426
28443
|
throw buildConflictError("imp", name, `an imp named ${name} exists; restore it --as another name`);
|
|
28427
28444
|
}
|
|
@@ -29579,6 +29596,31 @@ async function listDrivesInUse(db, findPaths) {
|
|
|
29579
29596
|
return drives;
|
|
29580
29597
|
}
|
|
29581
29598
|
|
|
29599
|
+
// packages/daemon/src/imps/imps/require-free-name.ts
|
|
29600
|
+
function readReservedName(https) {
|
|
29601
|
+
if (https === null || https.apiHost === https.domain) {
|
|
29602
|
+
return null;
|
|
29603
|
+
}
|
|
29604
|
+
return https.apiHost.slice(0, -(https.domain.length + 1));
|
|
29605
|
+
}
|
|
29606
|
+
function requireFreeName(https, name) {
|
|
29607
|
+
const reserved = readReservedName(https);
|
|
29608
|
+
if (reserved === null || https === null || name !== reserved) {
|
|
29609
|
+
return;
|
|
29610
|
+
}
|
|
29611
|
+
throw new ImpdError("BAD_REQUEST", {
|
|
29612
|
+
message: `imp name ${name} is taken: ${https.apiHost} serves impd's API and dashboard (IMP_API_HOST), so an imp named ${name} would share its host`
|
|
29613
|
+
});
|
|
29614
|
+
}
|
|
29615
|
+
async function requireNoImpNamedLikeApiHost(db, https) {
|
|
29616
|
+
const reserved = readReservedName(https);
|
|
29617
|
+
const holder = reserved === null ? undefined : await readImpByName(db, reserved);
|
|
29618
|
+
if (reserved === null || https === null || holder === undefined || holder.moveState === "receiving") {
|
|
29619
|
+
return;
|
|
29620
|
+
}
|
|
29621
|
+
throw new Error(`IMP_API_HOST ${https.apiHost} is the hostname of the imp ${reserved}; destroy that imp, or choose another host`);
|
|
29622
|
+
}
|
|
29623
|
+
|
|
29582
29624
|
// packages/daemon/src/imps/ssh/authorized-keys.ts
|
|
29583
29625
|
var import_ssh2 = __toESM(require_lib2(), 1);
|
|
29584
29626
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -32877,7 +32919,13 @@ function createKnownHosts(deps) {
|
|
|
32877
32919
|
read: async () => {
|
|
32878
32920
|
const status = await deps.readTailscale();
|
|
32879
32921
|
const addresses = status.ips.map(readAddressHost);
|
|
32880
|
-
const names = [
|
|
32922
|
+
const names = [
|
|
32923
|
+
...LOOPBACK_HOSTS2,
|
|
32924
|
+
status.hostname,
|
|
32925
|
+
status.dnsName,
|
|
32926
|
+
...addresses,
|
|
32927
|
+
deps.apiHost
|
|
32928
|
+
];
|
|
32881
32929
|
return new Set(names.filter((name) => name !== null).map((name) => name.toLowerCase()));
|
|
32882
32930
|
}
|
|
32883
32931
|
};
|
|
@@ -36049,13 +36097,14 @@ function readPublicInfo(config, imps, records) {
|
|
|
36049
36097
|
};
|
|
36050
36098
|
}
|
|
36051
36099
|
async function readHttpsInfo(deps) {
|
|
36052
|
-
const
|
|
36053
|
-
if (
|
|
36100
|
+
const https = deps.config.https;
|
|
36101
|
+
if (https === null) {
|
|
36054
36102
|
return null;
|
|
36055
36103
|
}
|
|
36056
36104
|
const token = deps.checkDnsToken === null ? null : await deps.checkDnsToken();
|
|
36057
36105
|
return {
|
|
36058
|
-
domain,
|
|
36106
|
+
domain: https.domain,
|
|
36107
|
+
apiHost: https.apiHost,
|
|
36059
36108
|
dnsToken: token === null ? null : { isOk: token.isOk, error: token.error, at: new Date(token.at) }
|
|
36060
36109
|
};
|
|
36061
36110
|
}
|
|
@@ -44049,6 +44098,23 @@ function resolveCpuSettings(input, current, hostCpus) {
|
|
|
44049
44098
|
return { limit, weight };
|
|
44050
44099
|
}
|
|
44051
44100
|
|
|
44101
|
+
// packages/daemon/src/imps/imps/resolve-imp-name.ts
|
|
44102
|
+
var NAME_ALPHABET2 = "abcdefghijkmnpqrstuvwxyz23456789";
|
|
44103
|
+
async function resolveImpName(context, requested, random = Math.random) {
|
|
44104
|
+
if (requested !== undefined) {
|
|
44105
|
+
return requested;
|
|
44106
|
+
}
|
|
44107
|
+
for (;; ) {
|
|
44108
|
+
const picks = Array.from({ length: 4 }, () => random() * NAME_ALPHABET2.length);
|
|
44109
|
+
const suffix = picks.map((pick) => NAME_ALPHABET2[Math.floor(pick)]).join("");
|
|
44110
|
+
const name = `imp-${suffix}`;
|
|
44111
|
+
const taken = await readImpByName(context.db, name);
|
|
44112
|
+
if (taken === undefined && name !== readReservedName(context.config.https)) {
|
|
44113
|
+
return name;
|
|
44114
|
+
}
|
|
44115
|
+
}
|
|
44116
|
+
}
|
|
44117
|
+
|
|
44052
44118
|
// packages/daemon/src/imps/imps/create-imp-record.ts
|
|
44053
44119
|
var CREATE_TRIES = 3;
|
|
44054
44120
|
async function createImpRecord(context, id, input, image) {
|
|
@@ -44092,21 +44158,6 @@ async function createImpRecord(context, id, input, image) {
|
|
|
44092
44158
|
}
|
|
44093
44159
|
}
|
|
44094
44160
|
}
|
|
44095
|
-
var NAME_ALPHABET2 = "abcdefghijkmnpqrstuvwxyz23456789";
|
|
44096
|
-
async function resolveImpName(context, requested) {
|
|
44097
|
-
if (requested !== undefined) {
|
|
44098
|
-
return requested;
|
|
44099
|
-
}
|
|
44100
|
-
for (;; ) {
|
|
44101
|
-
const picks = Array.from({ length: 4 }, () => Math.random() * NAME_ALPHABET2.length);
|
|
44102
|
-
const suffix = picks.map((pick) => NAME_ALPHABET2[Math.floor(pick)]).join("");
|
|
44103
|
-
const name = `imp-${suffix}`;
|
|
44104
|
-
const taken = await readImpByName(context.db, name);
|
|
44105
|
-
if (taken === undefined) {
|
|
44106
|
-
return name;
|
|
44107
|
-
}
|
|
44108
|
-
}
|
|
44109
|
-
}
|
|
44110
44161
|
|
|
44111
44162
|
// packages/daemon/src/imps/imps/imp-commands.ts
|
|
44112
44163
|
function createImpCommands(parts) {
|
|
@@ -44132,9 +44183,13 @@ function createImpCommands(parts) {
|
|
|
44132
44183
|
await removeImp(context.db, imp.id);
|
|
44133
44184
|
};
|
|
44134
44185
|
return {
|
|
44186
|
+
requireFreeName: (name) => {
|
|
44187
|
+
requireFreeName(context.config.https, name);
|
|
44188
|
+
},
|
|
44135
44189
|
createImp: async (input) => {
|
|
44136
44190
|
const received = performance.now();
|
|
44137
44191
|
const image = input.image;
|
|
44192
|
+
requireFreeName(context.config.https, input.name);
|
|
44138
44193
|
if (input.policy !== undefined) {
|
|
44139
44194
|
context.egress.requirePolicy(input.policy);
|
|
44140
44195
|
}
|
|
@@ -52355,6 +52410,7 @@ async function readMoveStream(deps, options) {
|
|
|
52355
52410
|
const header = MoveHeaderSchema.parse(readJsonPayload(first.payload));
|
|
52356
52411
|
const headerAt = deps.now();
|
|
52357
52412
|
requireTicketedName(row.name, header.imp.name);
|
|
52413
|
+
deps.imps.requireFreeName(header.imp.name);
|
|
52358
52414
|
if (await readImpById(deps.db, header.imp.id) !== undefined) {
|
|
52359
52415
|
throw new MoveRequestError("CONFLICT", `this host has an imp with id ${header.imp.id}`);
|
|
52360
52416
|
}
|
|
@@ -52640,6 +52696,7 @@ function createMoveReceiver(deps) {
|
|
|
52640
52696
|
if (deps.now() > row.stream_by) {
|
|
52641
52697
|
throw new MoveRequestError("GONE", "the move ticket expired before its stream started");
|
|
52642
52698
|
}
|
|
52699
|
+
deps.imps.requireFreeName(row.name);
|
|
52643
52700
|
const isClaimed = await claimMoveTicketStream(deps.db, row.id, deps.now());
|
|
52644
52701
|
if (!isClaimed) {
|
|
52645
52702
|
throw new MoveRequestError("CONFLICT", "the move ticket was used for a stream already");
|
|
@@ -52716,6 +52773,7 @@ function createMoveReceiver(deps) {
|
|
|
52716
52773
|
if (row.commit_until !== null && deps.now() > row.commit_until) {
|
|
52717
52774
|
throw new MoveRequestError("GONE", "the commit window ended; reissue the ticket");
|
|
52718
52775
|
}
|
|
52776
|
+
deps.imps.requireFreeName(row.name);
|
|
52719
52777
|
await writeCommit(imp, row);
|
|
52720
52778
|
return { isCommitted: true };
|
|
52721
52779
|
});
|
|
@@ -52745,6 +52803,7 @@ function createMoveReceiver(deps) {
|
|
|
52745
52803
|
};
|
|
52746
52804
|
return {
|
|
52747
52805
|
issueTicket: async (name, bytes, warm) => {
|
|
52806
|
+
deps.imps.requireFreeName(name);
|
|
52748
52807
|
const taken = await readImpByName(deps.db, name);
|
|
52749
52808
|
if (taken !== undefined) {
|
|
52750
52809
|
throw new ImpdError("CONFLICT", {
|
|
@@ -57082,7 +57141,7 @@ function createTailnetAccess(config, deps, readStatus) {
|
|
|
57082
57141
|
}),
|
|
57083
57142
|
knownHosts: createKnownHosts({
|
|
57084
57143
|
readTailscale,
|
|
57085
|
-
|
|
57144
|
+
apiHost: config.https?.apiHost ?? null
|
|
57086
57145
|
})
|
|
57087
57146
|
};
|
|
57088
57147
|
}
|
|
@@ -57967,7 +58026,7 @@ function createCloudflareProvider(options) {
|
|
|
57967
58026
|
const existing = RecordListSchema.parse(result).filter((item) => ADDRESS_TYPES.has(item.type ?? ""));
|
|
57968
58027
|
const foreign = existing.find((item) => item.comment !== owner);
|
|
57969
58028
|
if (foreign !== undefined) {
|
|
57970
|
-
throw new Error(`Cloudflare: ${fqdn} already has a record impd did not make (${foreign.type ?? ""} ${foreign.content}); remove it,
|
|
58029
|
+
throw new Error(`Cloudflare: ${fqdn} already has a record impd did not make (${foreign.type ?? ""} ${foreign.content}); remove it; when it is the bare IMP_DOMAIN, set IMP_API_HOST to put the API on a name of its own`);
|
|
57971
58030
|
}
|
|
57972
58031
|
if (existing.length > 1) {
|
|
57973
58032
|
getImpdLogger("https").warning("{fqdn} has {length} A records impd made; it updates only the first", { fqdn, length: String(existing.length) });
|
|
@@ -58222,18 +58281,21 @@ function normalizeHost(host) {
|
|
|
58222
58281
|
}
|
|
58223
58282
|
|
|
58224
58283
|
// packages/daemon/src/network/https/parse-domain-host.ts
|
|
58225
|
-
function parseDomainHost(host,
|
|
58284
|
+
function parseDomainHost(host, names) {
|
|
58226
58285
|
const hostname = normalizeHost(host);
|
|
58227
58286
|
if (hostname === null) {
|
|
58228
58287
|
return null;
|
|
58229
58288
|
}
|
|
58230
|
-
if (hostname ===
|
|
58231
|
-
return { kind: "
|
|
58289
|
+
if (hostname === names.apiHost) {
|
|
58290
|
+
return { kind: "api" };
|
|
58291
|
+
}
|
|
58292
|
+
if (hostname === names.domain) {
|
|
58293
|
+
return null;
|
|
58232
58294
|
}
|
|
58233
|
-
if (!hostname.endsWith(`.${domain}`)) {
|
|
58295
|
+
if (!hostname.endsWith(`.${names.domain}`)) {
|
|
58234
58296
|
return null;
|
|
58235
58297
|
}
|
|
58236
|
-
const label = hostname.slice(0, -(domain.length + 1));
|
|
58298
|
+
const label = hostname.slice(0, -(names.domain.length + 1));
|
|
58237
58299
|
const parsed = NameSchema.safeParse(label);
|
|
58238
58300
|
return parsed.success && !label.includes(".") ? { kind: "imp", name: parsed.data } : null;
|
|
58239
58301
|
}
|
|
@@ -58241,6 +58303,7 @@ function parseDomainHost(host, domain) {
|
|
|
58241
58303
|
// packages/daemon/src/network/https/https-listeners.ts
|
|
58242
58304
|
function createHttpsListeners(options) {
|
|
58243
58305
|
const domain = options.domain;
|
|
58306
|
+
const names = { domain, apiHost: options.apiHost };
|
|
58244
58307
|
const ports = { https: options.httpsPort, http: options.httpPort };
|
|
58245
58308
|
const byAddress = new Map;
|
|
58246
58309
|
const failed = new Set;
|
|
@@ -58249,18 +58312,18 @@ function createHttpsListeners(options) {
|
|
|
58249
58312
|
const readRedirectPort = () => scope.kind === "public" ? 443 : ports.https;
|
|
58250
58313
|
const hint = scope.kind === "public" ? "No public imp here." : `Use https://<imp>.${domain}/.`;
|
|
58251
58314
|
const resolveRoute = async (request) => {
|
|
58252
|
-
const parsed = parseDomainHost(request.headers.get("host"),
|
|
58315
|
+
const parsed = parseDomainHost(request.headers.get("host"), names);
|
|
58253
58316
|
if (parsed === null) {
|
|
58254
58317
|
return { kind: "none", hint };
|
|
58255
58318
|
}
|
|
58256
58319
|
if (scope.kind === "tailnet") {
|
|
58257
|
-
return parsed.kind === "
|
|
58320
|
+
return parsed.kind === "api" ? { kind: "api" } : parsed;
|
|
58258
58321
|
}
|
|
58259
58322
|
const route = parsed.kind === "imp" ? await scope.routeImp(parsed.name, request) : null;
|
|
58260
58323
|
return route ?? { kind: "none", hint };
|
|
58261
58324
|
};
|
|
58262
58325
|
const checkRedirect = (request) => {
|
|
58263
|
-
const parsed = parseDomainHost(request.headers.get("host"),
|
|
58326
|
+
const parsed = parseDomainHost(request.headers.get("host"), names);
|
|
58264
58327
|
if (parsed === null || scope.kind === "tailnet") {
|
|
58265
58328
|
return Promise.resolve(parsed !== null);
|
|
58266
58329
|
}
|
|
@@ -58295,7 +58358,7 @@ function createHttpsListeners(options) {
|
|
|
58295
58358
|
}));
|
|
58296
58359
|
const handleRedirectRequest = async (request) => {
|
|
58297
58360
|
const isRedirected = await checkRedirect(request);
|
|
58298
|
-
return isRedirected ? buildRedirect(request,
|
|
58361
|
+
return isRedirected ? buildRedirect(request, names, readRedirectPort(), hint) : buildErrorPage(404, hint);
|
|
58299
58362
|
};
|
|
58300
58363
|
const startRedirect = (address) => tryBind(address, "http", () => Bun.serve({
|
|
58301
58364
|
hostname: address,
|
|
@@ -58355,8 +58418,8 @@ function createHttpsListeners(options) {
|
|
|
58355
58418
|
}
|
|
58356
58419
|
};
|
|
58357
58420
|
}
|
|
58358
|
-
function buildRedirect(request,
|
|
58359
|
-
const parsed = parseDomainHost(request.headers.get("host"),
|
|
58421
|
+
function buildRedirect(request, names, httpsPort, hint) {
|
|
58422
|
+
const parsed = parseDomainHost(request.headers.get("host"), names);
|
|
58360
58423
|
if (parsed === null) {
|
|
58361
58424
|
return buildErrorPage(404, hint);
|
|
58362
58425
|
}
|
|
@@ -58365,12 +58428,12 @@ function buildRedirect(request, domain, httpsPort, hint) {
|
|
|
58365
58428
|
return new Response(null, {
|
|
58366
58429
|
status: 308,
|
|
58367
58430
|
headers: {
|
|
58368
|
-
location: `https://${buildHostname(parsed,
|
|
58431
|
+
location: `https://${buildHostname(parsed, names)}${port}${url.pathname}${url.search}`
|
|
58369
58432
|
}
|
|
58370
58433
|
});
|
|
58371
58434
|
}
|
|
58372
|
-
function buildHostname(route,
|
|
58373
|
-
return route.kind === "
|
|
58435
|
+
function buildHostname(route, names) {
|
|
58436
|
+
return route.kind === "api" ? names.apiHost : `${route.name}.${names.domain}`;
|
|
58374
58437
|
}
|
|
58375
58438
|
|
|
58376
58439
|
// packages/daemon/src/network/https/public-limits.ts
|
|
@@ -58395,6 +58458,7 @@ var ADDRESS_INTERVAL_MS = 30000;
|
|
|
58395
58458
|
function createHttpsService(deps) {
|
|
58396
58459
|
const config = deps.config;
|
|
58397
58460
|
const domain = config.domain;
|
|
58461
|
+
const apiHost = config.apiHost;
|
|
58398
58462
|
const certs = createCertManager({
|
|
58399
58463
|
domain,
|
|
58400
58464
|
store: deps.store,
|
|
@@ -58404,6 +58468,7 @@ function createHttpsService(deps) {
|
|
|
58404
58468
|
const listeners = createHttpsListeners({
|
|
58405
58469
|
proxy: deps.proxy,
|
|
58406
58470
|
domain,
|
|
58471
|
+
apiHost,
|
|
58407
58472
|
httpsPort: config.httpsPort,
|
|
58408
58473
|
httpPort: config.httpPort,
|
|
58409
58474
|
scope: { kind: "tailnet" }
|
|
@@ -58412,6 +58477,7 @@ function createHttpsService(deps) {
|
|
|
58412
58477
|
const publicListeners = publicConfig === null ? null : createHttpsListeners({
|
|
58413
58478
|
proxy: deps.proxy,
|
|
58414
58479
|
domain,
|
|
58480
|
+
apiHost,
|
|
58415
58481
|
httpsPort: publicConfig.httpsPort,
|
|
58416
58482
|
httpPort: publicConfig.httpPort,
|
|
58417
58483
|
scope: createPublicScope(deps.readPublicImpByName, createPublicLimits(deps.now))
|
|
@@ -58437,13 +58503,17 @@ function createHttpsService(deps) {
|
|
|
58437
58503
|
};
|
|
58438
58504
|
const setRecords = async (ip) => {
|
|
58439
58505
|
try {
|
|
58440
|
-
await deps.dns.setA(
|
|
58506
|
+
await deps.dns.setA(apiHost, ip);
|
|
58441
58507
|
await deps.dns.setA(`*.${domain}`, ip);
|
|
58442
58508
|
state.recordsIp = ip;
|
|
58443
58509
|
state.recordsError = null;
|
|
58444
|
-
getImpdLogger("https").info("{
|
|
58510
|
+
getImpdLogger("https").info("{apiHost} and *.{domain} point at {ip}", {
|
|
58511
|
+
apiHost,
|
|
58512
|
+
domain,
|
|
58513
|
+
ip
|
|
58514
|
+
});
|
|
58445
58515
|
} catch (error) {
|
|
58446
|
-
const message = `cannot point ${
|
|
58516
|
+
const message = `cannot point ${apiHost} at ${ip}: ${getErrorMessage(error)}`;
|
|
58447
58517
|
if (message !== state.recordsError) {
|
|
58448
58518
|
state.recordsError = message;
|
|
58449
58519
|
getImpdLogger("https").warning("{message}", { message });
|
|
@@ -60443,6 +60513,7 @@ async function startImpdParts(config, boundaries, plan) {
|
|
|
60443
60513
|
});
|
|
60444
60514
|
const db = await runStep("database", () => boundaries.db ?? openDatabase(join49(config.dataDir, "db", "imp.sqlite"), now));
|
|
60445
60515
|
plan.db = boundaries.db === undefined ? db : null;
|
|
60516
|
+
await requireNoImpNamedLikeApiHost(db, config.https);
|
|
60446
60517
|
const kernelOops = boundaries.imps?.kernelOops ?? createKernelOopsWatch();
|
|
60447
60518
|
const storage = boundaries.storage ?? createStorageBackend(config, { zfs: { isKernelOopsed: kernelOops.isOopsed } });
|
|
60448
60519
|
const deps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impz/testing",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0",
|
|
4
4
|
"description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"ts-pattern": "^5.9.2",
|
|
48
48
|
"xstate": "^5.33.3",
|
|
49
49
|
"zod": "^4.6.7",
|
|
50
|
-
"@impz/client": "7.
|
|
50
|
+
"@impz/client": "7.12.0"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"bun": ">=1.4.3"
|