@camstack/server 1.2.732 → 1.2.734
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/CHANGELOG.md +12 -0
- package/dist/core/agent/node-removal-hooks.js +25 -0
- package/dist/manual-boot.js +11 -0
- package/package.json +4 -9
- package/system/dist/addon-runner.js +107 -82928
- package/system/dist/addon-runner.mjs +106 -82927
- package/system/dist/{agent-https-DKMO-__h.js → agent-https-DEmi-YQ_.js} +1 -1
- package/system/dist/{agent-https-CDtAIEne.mjs → agent-https-DGp4gFzH.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +79 -8
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +90 -21
- package/system/dist/builtins/core-blocks/index.mjs +1 -1
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +131 -23
- package/system/dist/builtins/local-network/local-network.addon.mjs +131 -23
- package/system/dist/builtins/local-network/scan/dns-wire.d.ts +35 -2
- package/system/dist/builtins/local-network/scan/scan-engine.d.ts +1 -1
- package/system/dist/builtins/local-network/scan/scan-io.d.ts +6 -0
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-UQohOHgd.js → composition-sources-DfyoPtMe.js} +1 -1
- package/system/dist/{composition-sources-Ca7JEbmu.mjs → composition-sources-wVMwuZ-r.mjs} +1 -1
- package/system/dist/{constants-iG57sUNp.mjs → constants-C8fjD4YU.mjs} +1 -1
- package/system/dist/{constants-CLA4ogvA.js → constants-CavIW3ee.js} +1 -1
- package/system/dist/{device-ca--iHw76cR.mjs → device-ca-B1vN9ZRB.mjs} +1 -1
- package/system/dist/{device-ca-BUcHAAew.js → device-ca-b_fSvUlI.js} +1 -1
- package/system/dist/{dist-qO48FNMZ.js → dist-DDl6NKUe.js} +110 -82
- package/system/dist/{dist-C_cZ9rGK.mjs → dist-SXRVvbkS.mjs} +105 -77
- package/system/dist/{dns-wire-CHXO1qSl.js → dns-wire-B1BvF9Ao.js} +84 -13
- package/system/dist/{dns-wire-DcL6a0L-.mjs → dns-wire-Dm3H_7ST.mjs} +61 -14
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-DDmMPZCN.js → hub-mdns-ciao-95JXbLd5.js} +2 -2
- package/system/dist/{hub-mdns-ciao-9wPOmsXd.mjs → hub-mdns-ciao-euMLdIPi.mjs} +2 -2
- package/system/dist/index.d.ts +1 -0
- package/system/dist/index.js +46 -20
- package/system/dist/index.mjs +46 -21
- package/system/dist/kernel/addon-settings-store.d.ts +25 -0
- package/system/dist/kernel/device-settings-resolver.d.ts +27 -0
- package/system/dist/kernel/moleculer/runner-device-settings.d.ts +2 -0
- package/system/dist/kernel/settings-door-view.d.ts +5 -1
- package/system/dist/kernel/settings-view-types.d.ts +7 -1
- package/system/dist/migrations/hub/2026-11-02-addon-settings-node-id.d.ts +3 -0
- package/system/dist/migrations/hub/index.d.ts +3 -4
- package/system/dist/{restore-archive-Cravj5LG.js → restore-archive-CMkK7SeP.js} +1 -1
- package/system/dist/{restore-archive-BHVjOlza.mjs → restore-archive-DbtbDgPC.mjs} +1 -1
- package/system/dist/{retention-C_9dxCQn.mjs → retention-BGUmx4FD.mjs} +1 -1
- package/system/dist/{retention-B_eloRtb.js → retention-DI_dDceD.js} +1 -1
- package/system/dist/{wal-maintenance-CfKeIQAG.js → wal-maintenance-BaPMwUtL.js} +0 -0
- package/system/dist/{wal-maintenance-Dw7rplkv.mjs → wal-maintenance-CgHJ7XTw.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as deviceExtensionCapability, Bs as toSecretFieldView, F as DAY_NAMES, Gs as DeviceRole, Hr as legacyAutoLinkIds, Hs as userError, Is as secretTreeFromPaths, J as DeviceStatusSchema, Js as EventCategory, Ks as DeviceType, Ps as resolveSecretMarkers, Rs as sleep$1, Sr as formatMinutes, Vn as createDeviceExtensionProvider, Vs as transformSecretWrite, Wo as WELL_KNOWN_TAB_MAP, Ws as DeviceFeature, X as DiscoveryProposalBodySchema, Y as DeviceTombstoneSchema, Yi as runtimeStatePolicyFor, Yn as defineExtensionSlotProvider, ar as deviceStatusCapability, at as FieldClaimModeSchema, bi as parseStreamParamsFormPatch, bs as isSecretMarkerLike, cr as enumerateSchemaFields, do as BaseAddon, es as collectZodSecretPaths, fr as expandContainer, g as CAMERA_SWITCH_ORDER, gs as isKeychainStoredField, ir as deviceStateCapability, is as defineRecordKinds, ms as isDeviceConfigCap, o as ALL_CAPABILITY_DEFINITIONS, oa as siteZoneKey, ot as FieldClaimSchema, pi as normalizeUnit, qr as locationIconKey, qs as errMsg, sr as enumerateItemArrayFields, tr as deviceManagerCapability, v as CAP_NAMES_WITH_STATUS, vs as isSecretClear, wn as canonicalIconKey, xn as buildStreamParamsConfigSchema, xt as MINUTES_PER_DAY, ys as isSecretMarker, zo as SECRET_CLEAR, zt as STREAM_PROFILE_META } from "../../dist-SXRVvbkS.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
|
|
4
4
|
import { t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
|
|
5
5
|
import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { s as normalizeServiceType } from "../../dns-wire-Dm3H_7ST.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { canonicalDeviceFingerprint } from "@camstack/types/node";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xr as logDestinationCapability, do as BaseAddon } from "../../dist-SXRVvbkS.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_device_ca = require("../../device-ca-
|
|
6
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
7
|
+
const require_device_ca = require("../../device-ca-b_fSvUlI.js");
|
|
8
8
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
9
|
-
const require_constants = require("../../constants-
|
|
9
|
+
const require_constants = require("../../constants-CavIW3ee.js");
|
|
10
10
|
const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
|
|
11
11
|
let node_crypto = require("node:crypto");
|
|
12
12
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { As as parseSecretRef,
|
|
2
|
-
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca
|
|
1
|
+
import { As as parseSecretRef, Br as keychainAdminCapability, Ds as normalizeSecretOwner, Js as EventCategory, Vr as keychainCapability, _t as KeychainResetRecordSchema, cs as formatSecretScope, do as BaseAddon, gt as KeychainAuditEntrySchema, ht as KEYCHAIN_RESET_TRIGGER_ACTOR, is as defineRecordKinds } from "../../dist-SXRVvbkS.mjs";
|
|
2
|
+
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-B1vN9ZRB.mjs";
|
|
3
3
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
4
|
-
import { a as MESH_CA_KEY_REF } from "../../constants-
|
|
4
|
+
import { a as MESH_CA_KEY_REF } from "../../constants-C8fjD4YU.mjs";
|
|
5
5
|
import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
|
|
6
6
|
import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Js as EventCategory, Mt as RECORDING_SOURCE_CAMSTACK_ADDON, Pt as RecordingStatusSchema,
|
|
1
|
+
import { Js as EventCategory, Mt as RECORDING_SOURCE_CAMSTACK_ADDON, Pt as RecordingStatusSchema, do as BaseAddon, ei as mayWriteToLocation, qs as errMsg, ts as createEvent } from "../../dist-SXRVvbkS.mjs";
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { constants } from "node:fs";
|
|
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
7
7
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
8
|
const require_ms$1 = require("../../ms-LB3giGoU.js");
|
|
9
|
-
const require_device_ca = require("../../device-ca-
|
|
9
|
+
const require_device_ca = require("../../device-ca-b_fSvUlI.js");
|
|
10
10
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
11
11
|
let zod = require("zod");
|
|
12
12
|
let node_crypto = require("node:crypto");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $
|
|
2
|
+
import { $t as UserRecordSchema, A as CredentialTokenClaimsSchema, At as PreferenceValueSchema, Dt as PREFERENCES_MAX_VALUE_BYTES, Hs as userError, Ht as ScopedTokenSchema, Nr as isCredentialTokenPayload, Ot as PreferenceDeviceIdSchema, Qn as deviceCredentialsCapability, R as DEVICE_ENROLLMENT_TTL_MS, Sa as userManagementCapability, Ss as makeSecretMarker, V as DEVICE_NONCE_TTL_MS, Wt as SsoBridgeClaimsSchema, Zt as TokenScopeSchema, bn as buildDeviceSignatureMessage, do as BaseAddon, fn as authProviderCapability, is as defineRecordKinds, kt as PreferenceNamespaceSchema, w as CREDENTIAL_TOKEN_AUDIENCE, xr as formatDeviceRevoker, yn as buildDeviceEnrollmentLink, ys as isSecretMarker } from "../../dist-SXRVvbkS.mjs";
|
|
3
3
|
import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
|
|
4
4
|
import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
|
|
5
|
-
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca
|
|
5
|
+
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-B1vN9ZRB.mjs";
|
|
6
6
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as crypto$1 from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
4
|
-
const require_dns_wire = require("../../dns-wire-
|
|
5
|
-
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-
|
|
3
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
4
|
+
const require_dns_wire = require("../../dns-wire-B1BvF9Ao.js");
|
|
5
|
+
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-95JXbLd5.js");
|
|
6
6
|
let zod = require("zod");
|
|
7
7
|
let node_net = require("node:net");
|
|
8
8
|
let node_os = require("node:os");
|
|
@@ -716,6 +716,8 @@ var SCAN_REQUEST_TIMEOUT_MS = 1200;
|
|
|
716
716
|
/** Wi-Fi boards drop or late-answer one multicast query: send it three times, listen to the end. */
|
|
717
717
|
var MULTICAST_RESEND_AT_MS = [1200, 2500];
|
|
718
718
|
var MULTICAST_LISTEN_MS = 4500;
|
|
719
|
+
/** One follow-up question on a link (SRV+TXT, then A): sent once, listened to briefly. */
|
|
720
|
+
var FOLLOW_UP_LISTEN_MS = 1500;
|
|
719
721
|
/** Unicast DNS-SD probes to extra subnets get one retry. */
|
|
720
722
|
var UNICAST_RESEND_AT_MS = [900];
|
|
721
723
|
var UNICAST_LISTEN_MS = 2e3;
|
|
@@ -799,23 +801,47 @@ function hubLinks(interfaces) {
|
|
|
799
801
|
function instanceLabel(instance) {
|
|
800
802
|
return instance.split("._")[0] ?? instance;
|
|
801
803
|
}
|
|
804
|
+
async function exchangeOnLink(deps, link, groupQuery, fallbackQuery, timing = {
|
|
805
|
+
resendAtMs: MULTICAST_RESEND_AT_MS,
|
|
806
|
+
listenMs: MULTICAST_LISTEN_MS
|
|
807
|
+
}) {
|
|
808
|
+
const request = {
|
|
809
|
+
targets: [{
|
|
810
|
+
host: require_dns_wire.MDNS_GROUP,
|
|
811
|
+
port: require_dns_wire.MDNS_PORT
|
|
812
|
+
}],
|
|
813
|
+
localAddress: link.address,
|
|
814
|
+
...timing
|
|
815
|
+
};
|
|
816
|
+
try {
|
|
817
|
+
return await deps.io.udpExchange({
|
|
818
|
+
...request,
|
|
819
|
+
payload: groupQuery,
|
|
820
|
+
bindPort: require_dns_wire.MDNS_PORT,
|
|
821
|
+
joinGroup: require_dns_wire.MDNS_GROUP
|
|
822
|
+
});
|
|
823
|
+
} catch (err) {
|
|
824
|
+
deps.logger.warn("local-network: mdns group listen skipped on link, using unicast-response query", { meta: {
|
|
825
|
+
link: link.address,
|
|
826
|
+
interface: link.name,
|
|
827
|
+
error: require_dist.errMsg(err)
|
|
828
|
+
} });
|
|
829
|
+
return deps.io.udpExchange({
|
|
830
|
+
...request,
|
|
831
|
+
payload: fallbackQuery
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
}
|
|
802
835
|
async function runMdns(deps, entries, subnets, c) {
|
|
803
836
|
if (entries.length === 0) return;
|
|
804
|
-
const
|
|
837
|
+
const types = [...new Set(entries.map((e) => require_dns_wire.normalizeServiceType(e.mode.serviceType)))];
|
|
838
|
+
const query = require_dns_wire.buildPtrQuery(types);
|
|
839
|
+
const groupQuery = require_dns_wire.buildPtrQuery(types, { unicastResponse: false });
|
|
805
840
|
const replies = [];
|
|
806
841
|
const links = hubLinks(deps.interfaces());
|
|
807
842
|
for (const link of links) {
|
|
808
843
|
bucket(c, "mdns").probed += 1;
|
|
809
|
-
replies.push(...await deps
|
|
810
|
-
payload: query,
|
|
811
|
-
targets: [{
|
|
812
|
-
host: require_dns_wire.MDNS_GROUP,
|
|
813
|
-
port: require_dns_wire.MDNS_PORT
|
|
814
|
-
}],
|
|
815
|
-
localAddress: link.address,
|
|
816
|
-
resendAtMs: MULTICAST_RESEND_AT_MS,
|
|
817
|
-
listenMs: MULTICAST_LISTEN_MS
|
|
818
|
-
}));
|
|
844
|
+
replies.push(...await exchangeOnLink(deps, link, groupQuery, query));
|
|
819
845
|
}
|
|
820
846
|
const extraHosts = extraHostsOf(subnets);
|
|
821
847
|
if (extraHosts.length > 0) {
|
|
@@ -830,21 +856,92 @@ async function runMdns(deps, entries, subnets, c) {
|
|
|
830
856
|
listenMs: UNICAST_LISTEN_MS
|
|
831
857
|
}));
|
|
832
858
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
859
|
+
const records = require_dns_wire.emptyMdnsRecords();
|
|
860
|
+
for (const reply of dedupeReplies(replies)) require_dns_wire.mergeMdnsRecords(records, require_dns_wire.parseMdnsRecords(reply.data));
|
|
861
|
+
const wanted = wantedInstances(entries, records);
|
|
862
|
+
await followUp(deps, links, records, wanted, "srv", c);
|
|
863
|
+
await followUp(deps, links, records, wanted, "a", c);
|
|
864
|
+
const unresolved = /* @__PURE__ */ new Map();
|
|
865
|
+
for (const { ptr, label, entry } of wanted) {
|
|
866
|
+
const service = records.srv.get(ptr.instance.toLowerCase());
|
|
867
|
+
if (service === void 0) {
|
|
868
|
+
unresolved.set(ptr.instance, "srv-unresolved");
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
const host = records.addresses.get(service.target.toLowerCase());
|
|
872
|
+
if (host === void 0) {
|
|
873
|
+
unresolved.set(ptr.instance, "a-unresolved");
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
837
876
|
emit(c, entry, {
|
|
838
|
-
host
|
|
877
|
+
host,
|
|
839
878
|
port: service.port,
|
|
840
879
|
mdns: {
|
|
841
880
|
instance: label,
|
|
842
|
-
host: service.
|
|
881
|
+
host: service.target,
|
|
843
882
|
port: service.port,
|
|
844
|
-
txt:
|
|
883
|
+
txt: records.txt.get(ptr.instance.toLowerCase()) ?? {}
|
|
845
884
|
}
|
|
846
885
|
});
|
|
847
886
|
}
|
|
887
|
+
for (const [instance, reason] of unresolved) {
|
|
888
|
+
c.mdnsUnresolved += 1;
|
|
889
|
+
deps.logger.info("local-network: mdns instance not resolved, left out of the hits", { meta: {
|
|
890
|
+
instance: instanceLabel(instance),
|
|
891
|
+
reason
|
|
892
|
+
} });
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
/** The PTR answers some request asked for: its type and its instance pattern both match. */
|
|
896
|
+
function wantedInstances(entries, records) {
|
|
897
|
+
const out = [];
|
|
898
|
+
for (const ptr of records.ptrs) for (const entry of entries) {
|
|
899
|
+
if (require_dns_wire.normalizeServiceType(entry.mode.serviceType) !== require_dns_wire.normalizeServiceType(ptr.serviceType)) continue;
|
|
900
|
+
const label = instanceLabel(ptr.instance);
|
|
901
|
+
if (entry.mode.instancePattern !== void 0 && !matches(entry.mode.instancePattern, label)) continue;
|
|
902
|
+
out.push({
|
|
903
|
+
ptr,
|
|
904
|
+
label,
|
|
905
|
+
entry
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
return out;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* One follow-up question per link for what the PTR answer left out: SRV+TXT of the
|
|
912
|
+
* instances without an SRV, or the A record of the SRV targets without an address.
|
|
913
|
+
* The answers are folded in whichever packet carries them.
|
|
914
|
+
*/
|
|
915
|
+
async function followUp(deps, links, records, wanted, stage, c) {
|
|
916
|
+
const questions = /* @__PURE__ */ new Map();
|
|
917
|
+
for (const { ptr } of wanted) {
|
|
918
|
+
const service = records.srv.get(ptr.instance.toLowerCase());
|
|
919
|
+
if (stage === "srv" && service === void 0) {
|
|
920
|
+
questions.set(`SRV ${ptr.instance}`, {
|
|
921
|
+
name: ptr.instance,
|
|
922
|
+
type: "SRV"
|
|
923
|
+
});
|
|
924
|
+
questions.set(`TXT ${ptr.instance}`, {
|
|
925
|
+
name: ptr.instance,
|
|
926
|
+
type: "TXT"
|
|
927
|
+
});
|
|
928
|
+
} else if (stage === "a" && service !== void 0 && !records.addresses.has(service.target.toLowerCase())) questions.set(`A ${service.target}`, {
|
|
929
|
+
name: service.target,
|
|
930
|
+
type: "A"
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
if (questions.size === 0) return;
|
|
934
|
+
const list = [...questions.values()];
|
|
935
|
+
const groupQuery = require_dns_wire.buildRecordQuery(list);
|
|
936
|
+
const fallbackQuery = require_dns_wire.buildRecordQuery(list, { unicastResponse: true });
|
|
937
|
+
for (const link of links) {
|
|
938
|
+
bucket(c, "mdns").probed += 1;
|
|
939
|
+
const replies = await exchangeOnLink(deps, link, groupQuery, fallbackQuery, {
|
|
940
|
+
resendAtMs: [],
|
|
941
|
+
listenMs: FOLLOW_UP_LISTEN_MS
|
|
942
|
+
});
|
|
943
|
+
for (const reply of replies) require_dns_wire.mergeMdnsRecords(records, require_dns_wire.parseMdnsRecords(reply.data));
|
|
944
|
+
}
|
|
848
945
|
}
|
|
849
946
|
function matches(pattern, text) {
|
|
850
947
|
try {
|
|
@@ -1087,7 +1184,8 @@ async function runScan(deps, input) {
|
|
|
1087
1184
|
const c = {
|
|
1088
1185
|
hits: [],
|
|
1089
1186
|
errors: [],
|
|
1090
|
-
stats: /* @__PURE__ */ new Map()
|
|
1187
|
+
stats: /* @__PURE__ */ new Map(),
|
|
1188
|
+
mdnsUnresolved: 0
|
|
1091
1189
|
};
|
|
1092
1190
|
await Promise.all([
|
|
1093
1191
|
guarded(c, "mdns", () => runMdns(deps, entriesOf(input.requests, "mdns"), subnets, c)),
|
|
@@ -1109,6 +1207,7 @@ async function runScan(deps, input) {
|
|
|
1109
1207
|
hostsProbed: stats.hostsProbed,
|
|
1110
1208
|
hits: stats.hits,
|
|
1111
1209
|
timeouts: stats.timeouts,
|
|
1210
|
+
mdnsUnresolved: c.mdnsUnresolved,
|
|
1112
1211
|
errors: c.errors.length,
|
|
1113
1212
|
byMode,
|
|
1114
1213
|
hitsBySubnet: hitsBySubnet(subnets, c.hits),
|
|
@@ -1324,9 +1423,13 @@ function udpExchange(request) {
|
|
|
1324
1423
|
});
|
|
1325
1424
|
const replies = [];
|
|
1326
1425
|
let settled = false;
|
|
1426
|
+
let joined = false;
|
|
1327
1427
|
const finish = (error) => {
|
|
1328
1428
|
if (settled) return;
|
|
1329
1429
|
settled = true;
|
|
1430
|
+
if (joined && request.joinGroup !== void 0) try {
|
|
1431
|
+
socket.dropMembership(request.joinGroup, request.localAddress);
|
|
1432
|
+
} catch {}
|
|
1330
1433
|
try {
|
|
1331
1434
|
socket.close();
|
|
1332
1435
|
} catch {}
|
|
@@ -1341,8 +1444,13 @@ function udpExchange(request) {
|
|
|
1341
1444
|
data
|
|
1342
1445
|
});
|
|
1343
1446
|
});
|
|
1344
|
-
|
|
1447
|
+
const bindAddress = request.joinGroup === void 0 ? request.localAddress : void 0;
|
|
1448
|
+
socket.bind(request.bindPort ?? 0, bindAddress, () => {
|
|
1345
1449
|
try {
|
|
1450
|
+
if (request.joinGroup !== void 0) {
|
|
1451
|
+
socket.addMembership(request.joinGroup, request.localAddress);
|
|
1452
|
+
joined = true;
|
|
1453
|
+
}
|
|
1346
1454
|
if (request.broadcast === true) socket.setBroadcast(true);
|
|
1347
1455
|
if (request.localAddress !== void 0) socket.setMulticastInterface(request.localAddress);
|
|
1348
1456
|
} catch (err) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as parseMdnsMessage, i as
|
|
3
|
-
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-
|
|
1
|
+
import { Ar as isAppLinkBase, Dn as checkRoleAddress, Et as NetworkTunnelStartedDataSchema, Gi as resolveNotificationTapAddress, Js as EventCategory, Kr as localNetworkCapability, Li as resolveAppConnections, Pr as isDefaultAppConnectionEndpoint, Vi as resolveHubAddressRoles, _ as CAMSTACK_APP_LINK_ORIGIN, do as BaseAddon, dt as HUB_MDNS_TXT_KEYS, ia as shortHostname, qs as errMsg, ut as HUB_MDNS_SERVICE_TYPE, wa as validateCustomAddress, xi as pickAppLinkHub } from "../../dist-SXRVvbkS.mjs";
|
|
2
|
+
import { a as emptyMdnsRecords, c as parseMdnsMessage, i as buildRecordQuery, l as parseMdnsRecords, n as MDNS_PORT, o as mergeMdnsRecords, r as buildPtrQuery, s as normalizeServiceType, t as MDNS_GROUP } from "../../dns-wire-Dm3H_7ST.mjs";
|
|
3
|
+
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-euMLdIPi.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { isIP } from "node:net";
|
|
6
6
|
import * as os$1 from "node:os";
|
|
@@ -711,6 +711,8 @@ var SCAN_REQUEST_TIMEOUT_MS = 1200;
|
|
|
711
711
|
/** Wi-Fi boards drop or late-answer one multicast query: send it three times, listen to the end. */
|
|
712
712
|
var MULTICAST_RESEND_AT_MS = [1200, 2500];
|
|
713
713
|
var MULTICAST_LISTEN_MS = 4500;
|
|
714
|
+
/** One follow-up question on a link (SRV+TXT, then A): sent once, listened to briefly. */
|
|
715
|
+
var FOLLOW_UP_LISTEN_MS = 1500;
|
|
714
716
|
/** Unicast DNS-SD probes to extra subnets get one retry. */
|
|
715
717
|
var UNICAST_RESEND_AT_MS = [900];
|
|
716
718
|
var UNICAST_LISTEN_MS = 2e3;
|
|
@@ -794,23 +796,47 @@ function hubLinks(interfaces) {
|
|
|
794
796
|
function instanceLabel(instance) {
|
|
795
797
|
return instance.split("._")[0] ?? instance;
|
|
796
798
|
}
|
|
799
|
+
async function exchangeOnLink(deps, link, groupQuery, fallbackQuery, timing = {
|
|
800
|
+
resendAtMs: MULTICAST_RESEND_AT_MS,
|
|
801
|
+
listenMs: MULTICAST_LISTEN_MS
|
|
802
|
+
}) {
|
|
803
|
+
const request = {
|
|
804
|
+
targets: [{
|
|
805
|
+
host: MDNS_GROUP,
|
|
806
|
+
port: MDNS_PORT
|
|
807
|
+
}],
|
|
808
|
+
localAddress: link.address,
|
|
809
|
+
...timing
|
|
810
|
+
};
|
|
811
|
+
try {
|
|
812
|
+
return await deps.io.udpExchange({
|
|
813
|
+
...request,
|
|
814
|
+
payload: groupQuery,
|
|
815
|
+
bindPort: MDNS_PORT,
|
|
816
|
+
joinGroup: MDNS_GROUP
|
|
817
|
+
});
|
|
818
|
+
} catch (err) {
|
|
819
|
+
deps.logger.warn("local-network: mdns group listen skipped on link, using unicast-response query", { meta: {
|
|
820
|
+
link: link.address,
|
|
821
|
+
interface: link.name,
|
|
822
|
+
error: errMsg(err)
|
|
823
|
+
} });
|
|
824
|
+
return deps.io.udpExchange({
|
|
825
|
+
...request,
|
|
826
|
+
payload: fallbackQuery
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
}
|
|
797
830
|
async function runMdns(deps, entries, subnets, c) {
|
|
798
831
|
if (entries.length === 0) return;
|
|
799
|
-
const
|
|
832
|
+
const types = [...new Set(entries.map((e) => normalizeServiceType(e.mode.serviceType)))];
|
|
833
|
+
const query = buildPtrQuery(types);
|
|
834
|
+
const groupQuery = buildPtrQuery(types, { unicastResponse: false });
|
|
800
835
|
const replies = [];
|
|
801
836
|
const links = hubLinks(deps.interfaces());
|
|
802
837
|
for (const link of links) {
|
|
803
838
|
bucket(c, "mdns").probed += 1;
|
|
804
|
-
replies.push(...await deps
|
|
805
|
-
payload: query,
|
|
806
|
-
targets: [{
|
|
807
|
-
host: MDNS_GROUP,
|
|
808
|
-
port: MDNS_PORT
|
|
809
|
-
}],
|
|
810
|
-
localAddress: link.address,
|
|
811
|
-
resendAtMs: MULTICAST_RESEND_AT_MS,
|
|
812
|
-
listenMs: MULTICAST_LISTEN_MS
|
|
813
|
-
}));
|
|
839
|
+
replies.push(...await exchangeOnLink(deps, link, groupQuery, query));
|
|
814
840
|
}
|
|
815
841
|
const extraHosts = extraHostsOf(subnets);
|
|
816
842
|
if (extraHosts.length > 0) {
|
|
@@ -825,21 +851,92 @@ async function runMdns(deps, entries, subnets, c) {
|
|
|
825
851
|
listenMs: UNICAST_LISTEN_MS
|
|
826
852
|
}));
|
|
827
853
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
854
|
+
const records = emptyMdnsRecords();
|
|
855
|
+
for (const reply of dedupeReplies(replies)) mergeMdnsRecords(records, parseMdnsRecords(reply.data));
|
|
856
|
+
const wanted = wantedInstances(entries, records);
|
|
857
|
+
await followUp(deps, links, records, wanted, "srv", c);
|
|
858
|
+
await followUp(deps, links, records, wanted, "a", c);
|
|
859
|
+
const unresolved = /* @__PURE__ */ new Map();
|
|
860
|
+
for (const { ptr, label, entry } of wanted) {
|
|
861
|
+
const service = records.srv.get(ptr.instance.toLowerCase());
|
|
862
|
+
if (service === void 0) {
|
|
863
|
+
unresolved.set(ptr.instance, "srv-unresolved");
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
const host = records.addresses.get(service.target.toLowerCase());
|
|
867
|
+
if (host === void 0) {
|
|
868
|
+
unresolved.set(ptr.instance, "a-unresolved");
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
832
871
|
emit(c, entry, {
|
|
833
|
-
host
|
|
872
|
+
host,
|
|
834
873
|
port: service.port,
|
|
835
874
|
mdns: {
|
|
836
875
|
instance: label,
|
|
837
|
-
host: service.
|
|
876
|
+
host: service.target,
|
|
838
877
|
port: service.port,
|
|
839
|
-
txt:
|
|
878
|
+
txt: records.txt.get(ptr.instance.toLowerCase()) ?? {}
|
|
840
879
|
}
|
|
841
880
|
});
|
|
842
881
|
}
|
|
882
|
+
for (const [instance, reason] of unresolved) {
|
|
883
|
+
c.mdnsUnresolved += 1;
|
|
884
|
+
deps.logger.info("local-network: mdns instance not resolved, left out of the hits", { meta: {
|
|
885
|
+
instance: instanceLabel(instance),
|
|
886
|
+
reason
|
|
887
|
+
} });
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
/** The PTR answers some request asked for: its type and its instance pattern both match. */
|
|
891
|
+
function wantedInstances(entries, records) {
|
|
892
|
+
const out = [];
|
|
893
|
+
for (const ptr of records.ptrs) for (const entry of entries) {
|
|
894
|
+
if (normalizeServiceType(entry.mode.serviceType) !== normalizeServiceType(ptr.serviceType)) continue;
|
|
895
|
+
const label = instanceLabel(ptr.instance);
|
|
896
|
+
if (entry.mode.instancePattern !== void 0 && !matches(entry.mode.instancePattern, label)) continue;
|
|
897
|
+
out.push({
|
|
898
|
+
ptr,
|
|
899
|
+
label,
|
|
900
|
+
entry
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
return out;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* One follow-up question per link for what the PTR answer left out: SRV+TXT of the
|
|
907
|
+
* instances without an SRV, or the A record of the SRV targets without an address.
|
|
908
|
+
* The answers are folded in whichever packet carries them.
|
|
909
|
+
*/
|
|
910
|
+
async function followUp(deps, links, records, wanted, stage, c) {
|
|
911
|
+
const questions = /* @__PURE__ */ new Map();
|
|
912
|
+
for (const { ptr } of wanted) {
|
|
913
|
+
const service = records.srv.get(ptr.instance.toLowerCase());
|
|
914
|
+
if (stage === "srv" && service === void 0) {
|
|
915
|
+
questions.set(`SRV ${ptr.instance}`, {
|
|
916
|
+
name: ptr.instance,
|
|
917
|
+
type: "SRV"
|
|
918
|
+
});
|
|
919
|
+
questions.set(`TXT ${ptr.instance}`, {
|
|
920
|
+
name: ptr.instance,
|
|
921
|
+
type: "TXT"
|
|
922
|
+
});
|
|
923
|
+
} else if (stage === "a" && service !== void 0 && !records.addresses.has(service.target.toLowerCase())) questions.set(`A ${service.target}`, {
|
|
924
|
+
name: service.target,
|
|
925
|
+
type: "A"
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
if (questions.size === 0) return;
|
|
929
|
+
const list = [...questions.values()];
|
|
930
|
+
const groupQuery = buildRecordQuery(list);
|
|
931
|
+
const fallbackQuery = buildRecordQuery(list, { unicastResponse: true });
|
|
932
|
+
for (const link of links) {
|
|
933
|
+
bucket(c, "mdns").probed += 1;
|
|
934
|
+
const replies = await exchangeOnLink(deps, link, groupQuery, fallbackQuery, {
|
|
935
|
+
resendAtMs: [],
|
|
936
|
+
listenMs: FOLLOW_UP_LISTEN_MS
|
|
937
|
+
});
|
|
938
|
+
for (const reply of replies) mergeMdnsRecords(records, parseMdnsRecords(reply.data));
|
|
939
|
+
}
|
|
843
940
|
}
|
|
844
941
|
function matches(pattern, text) {
|
|
845
942
|
try {
|
|
@@ -1082,7 +1179,8 @@ async function runScan(deps, input) {
|
|
|
1082
1179
|
const c = {
|
|
1083
1180
|
hits: [],
|
|
1084
1181
|
errors: [],
|
|
1085
|
-
stats: /* @__PURE__ */ new Map()
|
|
1182
|
+
stats: /* @__PURE__ */ new Map(),
|
|
1183
|
+
mdnsUnresolved: 0
|
|
1086
1184
|
};
|
|
1087
1185
|
await Promise.all([
|
|
1088
1186
|
guarded(c, "mdns", () => runMdns(deps, entriesOf(input.requests, "mdns"), subnets, c)),
|
|
@@ -1104,6 +1202,7 @@ async function runScan(deps, input) {
|
|
|
1104
1202
|
hostsProbed: stats.hostsProbed,
|
|
1105
1203
|
hits: stats.hits,
|
|
1106
1204
|
timeouts: stats.timeouts,
|
|
1205
|
+
mdnsUnresolved: c.mdnsUnresolved,
|
|
1107
1206
|
errors: c.errors.length,
|
|
1108
1207
|
byMode,
|
|
1109
1208
|
hitsBySubnet: hitsBySubnet(subnets, c.hits),
|
|
@@ -1319,9 +1418,13 @@ function udpExchange(request) {
|
|
|
1319
1418
|
});
|
|
1320
1419
|
const replies = [];
|
|
1321
1420
|
let settled = false;
|
|
1421
|
+
let joined = false;
|
|
1322
1422
|
const finish = (error) => {
|
|
1323
1423
|
if (settled) return;
|
|
1324
1424
|
settled = true;
|
|
1425
|
+
if (joined && request.joinGroup !== void 0) try {
|
|
1426
|
+
socket.dropMembership(request.joinGroup, request.localAddress);
|
|
1427
|
+
} catch {}
|
|
1325
1428
|
try {
|
|
1326
1429
|
socket.close();
|
|
1327
1430
|
} catch {}
|
|
@@ -1336,8 +1439,13 @@ function udpExchange(request) {
|
|
|
1336
1439
|
data
|
|
1337
1440
|
});
|
|
1338
1441
|
});
|
|
1339
|
-
|
|
1442
|
+
const bindAddress = request.joinGroup === void 0 ? request.localAddress : void 0;
|
|
1443
|
+
socket.bind(request.bindPort ?? 0, bindAddress, () => {
|
|
1340
1444
|
try {
|
|
1445
|
+
if (request.joinGroup !== void 0) {
|
|
1446
|
+
socket.addMembership(request.joinGroup, request.localAddress);
|
|
1447
|
+
joined = true;
|
|
1448
|
+
}
|
|
1341
1449
|
if (request.broadcast === true) socket.setBroadcast(true);
|
|
1342
1450
|
if (request.localAddress !== void 0) socket.setMulticastInterface(request.localAddress);
|
|
1343
1451
|
} catch (err) {
|
|
@@ -11,7 +11,40 @@ export interface MdnsService {
|
|
|
11
11
|
readonly port: number;
|
|
12
12
|
readonly txt: Readonly<Record<string, string>>;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export interface PtrQueryOptions {
|
|
15
|
+
/** Unicast-reply bit (QU). Default true; a group member asks QM so a reflected answer reaches it. */
|
|
16
|
+
readonly unicastResponse?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** One PTR question per service type, with the unicast-reply bit unless `unicastResponse` is false. */
|
|
19
|
+
export declare function buildPtrQuery(serviceTypes: readonly string[], options?: PtrQueryOptions): Buffer;
|
|
20
|
+
export type RecordQuestionType = "SRV" | "TXT" | "A";
|
|
21
|
+
export interface RecordQuestion {
|
|
22
|
+
/** Full DNS name, e.g. `VELUX_KLF_LAN_C527._http._tcp.local` or `velux.local`. */
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly type: RecordQuestionType;
|
|
25
|
+
}
|
|
26
|
+
/** A QM (or QU when `unicastResponse`) question per record, for the follow-up that resolves an instance. */
|
|
27
|
+
export declare function buildRecordQuery(questions: readonly RecordQuestion[], options?: {
|
|
28
|
+
readonly unicastResponse?: boolean;
|
|
29
|
+
}): Buffer;
|
|
30
|
+
export interface MdnsRecords {
|
|
31
|
+
readonly ptrs: {
|
|
32
|
+
readonly serviceType: string;
|
|
33
|
+
readonly instance: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** Keyed by lower-cased instance name. */
|
|
36
|
+
readonly srv: Map<string, {
|
|
37
|
+
readonly target: string;
|
|
38
|
+
readonly port: number;
|
|
39
|
+
}>;
|
|
40
|
+
readonly txt: Map<string, Record<string, string>>;
|
|
41
|
+
/** Keyed by lower-cased host name. */
|
|
42
|
+
readonly addresses: Map<string, string>;
|
|
43
|
+
}
|
|
44
|
+
export declare function emptyMdnsRecords(): MdnsRecords;
|
|
45
|
+
/** Fold the records of one message into `into`: an answer may arrive in any packet (a reflector forwards them). */
|
|
46
|
+
export declare function mergeMdnsRecords(into: MdnsRecords, from: MdnsRecords): void;
|
|
47
|
+
/** Every PTR/SRV/TXT/A record of one mDNS message; a malformed packet yields none. */
|
|
48
|
+
export declare function parseMdnsRecords(buf: Buffer): MdnsRecords;
|
|
16
49
|
/** The services advertised on one mDNS message; a malformed packet yields none. */
|
|
17
50
|
export declare function parseMdnsMessage(buf: Buffer): readonly MdnsService[];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Bounded: 64 requests in flight, 1.2 s per request, 4096 hosts per scan.
|
|
15
15
|
* The sockets are injected ({@link ScanIo}), so this is unit-testable.
|
|
16
16
|
*/
|
|
17
|
-
import type
|
|
17
|
+
import { type IScopedLogger, type LocalInterface, type ScanNetworkResult, type ScanRequest } from "@camstack/types";
|
|
18
18
|
import { type ScanIo } from "./scan-io.js";
|
|
19
19
|
export declare const SCAN_CONCURRENCY = 64;
|
|
20
20
|
export declare const SCAN_REQUEST_TIMEOUT_MS = 1200;
|
|
@@ -15,6 +15,12 @@ export interface UdpExchangeRequest {
|
|
|
15
15
|
/** Fixed source port: devices that answer to a port other than the sender's. */
|
|
16
16
|
readonly bindPort?: number;
|
|
17
17
|
readonly broadcast?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Join this multicast group on `localAddress` and listen on the bound port, so an
|
|
20
|
+
* answer sent to the group (a router-reflected one) is heard. Rejects when the
|
|
21
|
+
* bind or the membership fails; the membership is dropped when the window ends.
|
|
22
|
+
*/
|
|
23
|
+
readonly joinGroup?: string;
|
|
18
24
|
/** Offsets (ms after the first burst) at which the same burst is sent again. */
|
|
19
25
|
readonly resendAtMs?: readonly number[];
|
|
20
26
|
/** How long to keep listening after the first burst. */
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DDl6NKUe.js");
|
|
7
7
|
const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xr as logDestinationCapability, do as BaseAddon } from "../../dist-SXRVvbkS.mjs";
|
|
2
2
|
import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/loki-logging/loki-payload.ts
|