matterbridge 3.5.0 → 3.5.1-dev-20260121-22e98b4
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 +14 -0
- package/bin/mb_coap.js +1 -1
- package/bin/mb_mdns.js +1 -1
- package/dist/broadcastServer.d.ts +0 -115
- package/dist/broadcastServer.js +1 -119
- package/dist/broadcastServerTypes.d.ts +0 -43
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.d.ts +1 -26
- package/dist/cli.js +2 -102
- package/dist/cliEmitter.d.ts +0 -36
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.d.ts +0 -42
- package/dist/cliHistory.js +1 -39
- package/dist/clusters/export.d.ts +0 -1
- package/dist/clusters/export.js +0 -2
- package/dist/deviceManager.d.ts +0 -108
- package/dist/deviceManager.js +2 -114
- package/dist/devices/airConditioner.d.ts +0 -75
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/batteryStorage.d.ts +0 -43
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/cooktop.d.ts +0 -55
- package/dist/devices/cooktop.js +0 -56
- package/dist/devices/dishwasher.d.ts +0 -55
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.d.ts +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.d.ts +0 -1
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.d.ts +0 -41
- package/dist/devices/extractorHood.js +0 -43
- package/dist/devices/heatPump.d.ts +0 -43
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.d.ts +0 -58
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.d.ts +0 -64
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.d.ts +1 -77
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.d.ts +0 -82
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.d.ts +0 -100
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.d.ts +0 -36
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.d.ts +0 -79
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.d.ts +0 -21
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.d.ts +0 -74
- package/dist/devices/waterHeater.js +2 -82
- package/dist/frontend.d.ts +0 -187
- package/dist/frontend.js +39 -505
- package/dist/frontendTypes.d.ts +0 -57
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.d.ts +0 -43
- package/dist/helpers.js +1 -54
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -25
- package/dist/jestutils/export.d.ts +0 -1
- package/dist/jestutils/export.js +0 -1
- package/dist/jestutils/jestHelpers.d.ts +0 -255
- package/dist/jestutils/jestHelpers.js +14 -372
- package/dist/logger/export.d.ts +0 -1
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.d.ts +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.d.ts +0 -1
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.d.ts +0 -1
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.d.ts +0 -1
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.d.ts +0 -1
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.d.ts +0 -1
- package/dist/matter/types.js +0 -2
- package/dist/matterNode.d.ts +0 -258
- package/dist/matterNode.js +9 -364
- package/dist/matterbridge.d.ts +0 -362
- package/dist/matterbridge.js +60 -860
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -36
- package/dist/matterbridgeAccessoryPlatform.js +0 -38
- package/dist/matterbridgeBehaviors.d.ts +0 -24
- package/dist/matterbridgeBehaviors.js +5 -68
- package/dist/matterbridgeDeviceTypes.d.ts +0 -649
- package/dist/matterbridgeDeviceTypes.js +6 -673
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -36
- package/dist/matterbridgeDynamicPlatform.js +0 -38
- package/dist/matterbridgeEndpoint.d.ts +2 -1332
- package/dist/matterbridgeEndpoint.js +94 -1459
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
- package/dist/matterbridgeEndpointHelpers.js +21 -486
- package/dist/matterbridgeEndpointTypes.d.ts +0 -70
- package/dist/matterbridgeEndpointTypes.js +0 -25
- package/dist/matterbridgePlatform.d.ts +0 -425
- package/dist/matterbridgePlatform.js +2 -453
- package/dist/matterbridgeTypes.d.ts +0 -46
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/mb_coap.d.ts +1 -0
- package/dist/{dgram/mb_coap.js → mb_coap.js} +3 -41
- package/dist/mb_mdns.d.ts +1 -0
- package/dist/{dgram/mb_mdns.js → mb_mdns.js} +37 -81
- package/dist/pluginManager.d.ts +0 -305
- package/dist/pluginManager.js +8 -345
- package/dist/shelly.d.ts +0 -157
- package/dist/shelly.js +7 -178
- package/dist/spawn.d.ts +1 -0
- package/dist/{utils/spawn.js → spawn.js} +3 -73
- package/dist/storage/export.d.ts +0 -1
- package/dist/storage/export.js +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.js +7 -100
- package/dist/utils/export.d.ts +1 -13
- package/dist/utils/export.js +1 -13
- package/dist/workerGlobalPrefix.d.ts +0 -24
- package/dist/workerGlobalPrefix.js +6 -40
- package/dist/workerTypes.d.ts +0 -25
- package/dist/workerTypes.js +0 -24
- package/dist/workers.d.ts +0 -61
- package/dist/workers.js +4 -68
- package/npm-shrinkwrap.json +35 -5
- package/package.json +5 -5
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js +0 -365
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -144
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js +0 -363
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -371
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js +0 -934
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js +0 -179
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -64
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js +0 -100
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jestutils/export.d.ts.map +0 -1
- package/dist/jestutils/export.js.map +0 -1
- package/dist/jestutils/jestHelpers.d.ts.map +0 -1
- package/dist/jestutils/jestHelpers.js.map +0 -1
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterNode.d.ts.map +0 -1
- package/dist/matterNode.js.map +0 -1
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
- package/dist/matterbridgeEndpointTypes.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -101
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js +0 -282
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -66
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js +0 -123
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -35
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js +0 -76
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js +0 -54
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js +0 -114
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js +0 -79
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js +0 -129
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -45
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -54
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/format.d.ts +0 -53
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -78
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js +0 -242
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/inspector.d.ts +0 -87
- package/dist/utils/inspector.d.ts.map +0 -1
- package/dist/utils/inspector.js +0 -268
- package/dist/utils/inspector.js.map +0 -1
- package/dist/utils/isValid.d.ts +0 -103
- package/dist/utils/isValid.d.ts.map +0 -1
- package/dist/utils/isValid.js +0 -162
- package/dist/utils/isValid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -141
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js +0 -314
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -33
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/tracker.d.ts +0 -108
- package/dist/utils/tracker.d.ts.map +0 -1
- package/dist/utils/tracker.js +0 -264
- package/dist/utils/tracker.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js +0 -125
- package/dist/utils/wait.js.map +0 -1
- package/dist/workerGlobalPrefix.d.ts.map +0 -1
- package/dist/workerGlobalPrefix.js.map +0 -1
- package/dist/workerTypes.d.ts.map +0 -1
- package/dist/workerTypes.js.map +0 -1
- package/dist/workers.d.ts.map +0 -1
- package/dist/workers.js.map +0 -1
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the types for Matterbridge.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeTypes.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2024-07-12
|
|
7
|
-
* @version 1.0.3
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
1
|
import type { NodeStorage } from 'node-persist-manager';
|
|
25
2
|
import type { LogLevel } from 'node-ansi-logger';
|
|
26
3
|
import type { ServerNode, Endpoint as EndpointNode } from '@matter/node';
|
|
@@ -41,14 +18,9 @@ export declare const MATTER_STORAGE_NAME = "matterstorage";
|
|
|
41
18
|
export declare const MATTERBRIDGE_DIAGNOSTIC_FILE = "diagnostic.log";
|
|
42
19
|
export declare const MATTERBRIDGE_HISTORY_FILE = "history.html";
|
|
43
20
|
export type MaybePromise<T> = T | Promise<T>;
|
|
44
|
-
/**
|
|
45
|
-
* A type representing a read-only subset of the Matterbridge properties.
|
|
46
|
-
*/
|
|
47
21
|
export type SharedMatterbridge = Readonly<Pick<Matterbridge, 'systemInformation' | 'rootDirectory' | 'homeDirectory' | 'matterbridgeDirectory' | 'matterbridgePluginDirectory' | 'matterbridgeCertDirectory' | 'globalModulesDirectory' | 'matterbridgeVersion' | 'matterbridgeLatestVersion' | 'matterbridgeDevVersion' | 'frontendVersion' | 'bridgeMode' | 'restartMode' | 'virtualMode' | 'profile' | 'logLevel' | 'fileLogger' | 'matterLogLevel' | 'matterFileLogger' | 'mdnsInterface' | 'ipv4Address' | 'ipv6Address' | 'port' | 'discriminator' | 'passcode' | 'shellySysUpdate' | 'shellyMainUpdate'>>;
|
|
48
22
|
export type PluginName = string;
|
|
49
|
-
/** Define an interface for matterbridge */
|
|
50
23
|
export interface Plugin extends ApiPlugin {
|
|
51
|
-
/** Node storage context created in the directory 'storage' in matterbridgeDirectory with the plugin name */
|
|
52
24
|
nodeContext?: NodeStorage;
|
|
53
25
|
storageContext?: StorageContext;
|
|
54
26
|
serverNode?: ServerNode<ServerNode.RootEndpoint>;
|
|
@@ -57,7 +29,6 @@ export interface Plugin extends ApiPlugin {
|
|
|
57
29
|
platform?: MatterbridgePlatform;
|
|
58
30
|
reachabilityTimeout?: NodeJS.Timeout;
|
|
59
31
|
}
|
|
60
|
-
/** Define an interface for the frontend */
|
|
61
32
|
export interface ApiPlugin extends StoragePlugin {
|
|
62
33
|
latestVersion?: string;
|
|
63
34
|
devVersion?: string;
|
|
@@ -70,7 +41,6 @@ export interface ApiPlugin extends StoragePlugin {
|
|
|
70
41
|
loaded?: boolean;
|
|
71
42
|
started?: boolean;
|
|
72
43
|
configured?: boolean;
|
|
73
|
-
/** Signal that the config has changed and a restart is required */
|
|
74
44
|
restartRequired?: boolean;
|
|
75
45
|
registeredDevices?: number;
|
|
76
46
|
configJson?: PlatformConfig;
|
|
@@ -79,7 +49,6 @@ export interface ApiPlugin extends StoragePlugin {
|
|
|
79
49
|
hasBlackList?: boolean;
|
|
80
50
|
matter?: ApiMatter;
|
|
81
51
|
}
|
|
82
|
-
/** Define an interface for storing the plugin information */
|
|
83
52
|
export interface StoragePlugin {
|
|
84
53
|
name: string;
|
|
85
54
|
path: string;
|
|
@@ -89,7 +58,6 @@ export interface StoragePlugin {
|
|
|
89
58
|
author: string;
|
|
90
59
|
enabled: boolean;
|
|
91
60
|
}
|
|
92
|
-
/** Define an interface for the system information */
|
|
93
61
|
export interface SystemInformation {
|
|
94
62
|
interfaceName: string;
|
|
95
63
|
macAddress: string;
|
|
@@ -112,7 +80,6 @@ export interface SystemInformation {
|
|
|
112
80
|
heapTotal: string;
|
|
113
81
|
heapUsed: string;
|
|
114
82
|
}
|
|
115
|
-
/** Define an interface for the matterbridge information */
|
|
116
83
|
export interface MatterbridgeInformation {
|
|
117
84
|
rootDirectory: string;
|
|
118
85
|
homeDirectory: string;
|
|
@@ -146,7 +113,6 @@ export interface MatterbridgeInformation {
|
|
|
146
113
|
fixedRestartRequired: boolean;
|
|
147
114
|
updateRequired: boolean;
|
|
148
115
|
}
|
|
149
|
-
/** Define an interface for sanitized exposed fabric information suitable for API responses */
|
|
150
116
|
export interface SanitizedExposedFabricInformation {
|
|
151
117
|
fabricIndex: FabricIndex;
|
|
152
118
|
fabricId: string;
|
|
@@ -156,7 +122,6 @@ export interface SanitizedExposedFabricInformation {
|
|
|
156
122
|
rootVendorName: string;
|
|
157
123
|
label: string;
|
|
158
124
|
}
|
|
159
|
-
/** Define an interface for sanitized session information suitable for API responses */
|
|
160
125
|
export interface SanitizedSession {
|
|
161
126
|
name: string;
|
|
162
127
|
nodeId: string;
|
|
@@ -167,7 +132,6 @@ export interface SanitizedSession {
|
|
|
167
132
|
lastActiveTimestamp: string;
|
|
168
133
|
numberOfActiveSubscriptions: number;
|
|
169
134
|
}
|
|
170
|
-
/** Define an interface for API device information */
|
|
171
135
|
export interface ApiDevice {
|
|
172
136
|
pluginName: string;
|
|
173
137
|
type: string;
|
|
@@ -183,7 +147,6 @@ export interface ApiDevice {
|
|
|
183
147
|
cluster: string;
|
|
184
148
|
matter?: ApiMatter;
|
|
185
149
|
}
|
|
186
|
-
/** Define an interface for base device information */
|
|
187
150
|
export interface BaseDevice {
|
|
188
151
|
mode: 'server' | 'matter' | undefined;
|
|
189
152
|
plugin: string | undefined;
|
|
@@ -207,7 +170,6 @@ export interface BaseDevice {
|
|
|
207
170
|
number: EndpointNumber | undefined;
|
|
208
171
|
id: string | undefined;
|
|
209
172
|
}
|
|
210
|
-
/** Define an interface for API matter information */
|
|
211
173
|
export interface ApiMatter {
|
|
212
174
|
id: string;
|
|
213
175
|
online: boolean;
|
|
@@ -221,25 +183,18 @@ export interface ApiMatter {
|
|
|
221
183
|
manualPairingCode: string;
|
|
222
184
|
serialNumber: string | undefined;
|
|
223
185
|
}
|
|
224
|
-
/** Define an interface for API clusters information */
|
|
225
186
|
export interface ApiClusters {
|
|
226
187
|
plugin: string;
|
|
227
188
|
deviceName: string;
|
|
228
189
|
serialNumber: string;
|
|
229
|
-
/** Endpoint number */
|
|
230
190
|
number: EndpointNumber;
|
|
231
|
-
/** Endpoint id */
|
|
232
191
|
id: string;
|
|
233
192
|
deviceTypes: number[];
|
|
234
193
|
clusters: Cluster[];
|
|
235
194
|
}
|
|
236
|
-
/** Define an interface for Cluster information in ApiClusters */
|
|
237
195
|
export interface Cluster {
|
|
238
|
-
/** Endpoint number > string */
|
|
239
196
|
endpoint: string;
|
|
240
|
-
/** Endpoint number */
|
|
241
197
|
number: EndpointNumber;
|
|
242
|
-
/** Endpoint id or main for the device root endpoint */
|
|
243
198
|
id: string;
|
|
244
199
|
deviceTypes: number[];
|
|
245
200
|
clusterName: string;
|
|
@@ -249,4 +204,3 @@ export interface Cluster {
|
|
|
249
204
|
attributeValue: string;
|
|
250
205
|
attributeLocalValue: unknown;
|
|
251
206
|
}
|
|
252
|
-
//# sourceMappingURL=matterbridgeTypes.d.ts.map
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the types for Matterbridge.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeTypes.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2024-07-12
|
|
7
|
-
* @version 1.0.3
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
// Default colors
|
|
25
1
|
export const plg = '\u001B[38;5;33m';
|
|
26
2
|
export const dev = '\u001B[38;5;79m';
|
|
27
3
|
export const typ = '\u001B[38;5;207m';
|
|
28
|
-
// Default names
|
|
29
4
|
export const MATTERBRIDGE_LOGGER_FILE = 'matterbridge.log';
|
|
30
5
|
export const MATTER_LOGGER_FILE = 'matter.log';
|
|
31
6
|
export const NODE_STORAGE_DIR = 'storage';
|
|
32
7
|
export const MATTER_STORAGE_NAME = 'matterstorage';
|
|
33
8
|
export const MATTERBRIDGE_DIAGNOSTIC_FILE = 'diagnostic.log';
|
|
34
9
|
export const MATTERBRIDGE_HISTORY_FILE = 'history.html';
|
|
35
|
-
//# sourceMappingURL=matterbridgeTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,64 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the bin mb_coap for the class Coap.
|
|
3
|
-
* @file src/dgram/mb_coap.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-07-22
|
|
6
|
-
* @version 1.0.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
// Net imports
|
|
24
1
|
import { COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAST_PORT, Coap, COAP_OPTION_URI_PATH } from '@matterbridge/dgram';
|
|
25
|
-
// istanbul ignore next
|
|
26
2
|
{
|
|
27
3
|
const coapIpv4 = new Coap('CoAP Server udp4', COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_PORT, 'udp4', true);
|
|
28
4
|
const coapIpv6 = new Coap('CoAP Server udp6', COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAST_PORT, 'udp6', true);
|
|
29
5
|
coapIpv4.listNetworkInterfaces();
|
|
30
|
-
/**
|
|
31
|
-
* Cleanup and log device information before exiting.
|
|
32
|
-
*/
|
|
33
6
|
function cleanupAndLogAndExit() {
|
|
34
7
|
if (process.argv.includes('--coap-udp4'))
|
|
35
8
|
coapIpv4.stop();
|
|
36
9
|
if (process.argv.includes('--coap-udp6'))
|
|
37
10
|
coapIpv6.stop();
|
|
38
|
-
// eslint-disable-next-line n/no-process-exit
|
|
39
11
|
process.exit(0);
|
|
40
12
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Queries mDNS services over UDP IPv4 and sends a response for a specific service instance.
|
|
43
|
-
* This function sends a query for Shelly, HTTP, and services, and responds with the appropriate PTR records.
|
|
44
|
-
*/
|
|
45
13
|
const requestUdp4 = () => {
|
|
46
14
|
coapIpv4.sendRequest(32000, [
|
|
47
15
|
{ number: COAP_OPTION_URI_PATH, value: Buffer.from('cit') },
|
|
48
16
|
{ number: COAP_OPTION_URI_PATH, value: Buffer.from('d') },
|
|
49
17
|
], {}, undefined, COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_PORT);
|
|
50
18
|
};
|
|
51
|
-
/**
|
|
52
|
-
* Queries mDNS services over UDP IPv4 and sends a response for a specific service instance.
|
|
53
|
-
* This function sends a query for Shelly, HTTP, and services, and responds with the appropriate PTR records.
|
|
54
|
-
*/
|
|
55
19
|
const requestUdp6 = () => {
|
|
56
20
|
coapIpv6.sendRequest(32000, [
|
|
57
21
|
{ number: COAP_OPTION_URI_PATH, value: Buffer.from('cit') },
|
|
58
22
|
{ number: COAP_OPTION_URI_PATH, value: Buffer.from('d') },
|
|
59
23
|
], {}, undefined, COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAST_PORT);
|
|
60
24
|
};
|
|
61
|
-
// Handle Ctrl+C (SIGINT) to stop and log devices
|
|
62
25
|
process.on('SIGINT', () => {
|
|
63
26
|
cleanupAndLogAndExit();
|
|
64
27
|
});
|
|
@@ -66,7 +29,7 @@ import { COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAS
|
|
|
66
29
|
coapIpv4.on('ready', (address) => {
|
|
67
30
|
coapIpv4.log.info(`coapIpv4 server ready on ${address.family} ${address.address}:${address.port}`);
|
|
68
31
|
if (!process.argv.includes('--coap-request'))
|
|
69
|
-
return;
|
|
32
|
+
return;
|
|
70
33
|
requestUdp4();
|
|
71
34
|
setInterval(() => {
|
|
72
35
|
requestUdp4();
|
|
@@ -76,7 +39,7 @@ import { COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAS
|
|
|
76
39
|
coapIpv6.on('ready', (address) => {
|
|
77
40
|
coapIpv6.log.info(`coapIpv6 server ready on ${address.family} ${address.address}:${address.port}`);
|
|
78
41
|
if (!process.argv.includes('--coap-request'))
|
|
79
|
-
return;
|
|
42
|
+
return;
|
|
80
43
|
requestUdp6();
|
|
81
44
|
setInterval(() => {
|
|
82
45
|
requestUdp6();
|
|
@@ -84,6 +47,5 @@ import { COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_IPV6_ADDRESS, COAP_MULTICAS
|
|
|
84
47
|
});
|
|
85
48
|
setTimeout(() => {
|
|
86
49
|
cleanupAndLogAndExit();
|
|
87
|
-
}, 600000);
|
|
50
|
+
}, 600000);
|
|
88
51
|
}
|
|
89
|
-
//# sourceMappingURL=mb_coap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,36 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the bin mb_mdns for the class Mdns.
|
|
3
|
-
* @file src/dgram/mb_mdns.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-07-22
|
|
6
|
-
* @version 1.0.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
1
|
import os from 'node:os';
|
|
24
|
-
// Net imports
|
|
25
2
|
import { MDNS_MULTICAST_IPV4_ADDRESS, MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, Mdns } from '@matterbridge/dgram';
|
|
26
|
-
// Utils imports
|
|
27
3
|
import { getIntParameter, getParameter, getStringArrayParameter, hasParameter } from '@matterbridge/utils';
|
|
28
|
-
// istanbul ignore next
|
|
29
4
|
{
|
|
30
5
|
if (hasParameter('h') || hasParameter('help')) {
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
6
|
console.log(`Copyright (c) Matterbridge. All rights reserved. Version 1.0.0.\n`);
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
7
|
console.log(`Usage: mb_mdns [options...]
|
|
35
8
|
|
|
36
9
|
If no command line is provided, mb_mdns shows all incoming mDNS records on all interfaces (0.0.0.0 and ::).
|
|
@@ -71,20 +44,15 @@ Examples:
|
|
|
71
44
|
# Query each 5s and listen for _matterbridge._tcp.local service records
|
|
72
45
|
mb_mdns --query 5000 --filter _matterbridge._tcp.local
|
|
73
46
|
`);
|
|
74
|
-
// eslint-disable-next-line n/no-process-exit
|
|
75
47
|
process.exit(0);
|
|
76
48
|
}
|
|
77
|
-
|
|
78
|
-
const { default: pkg } = await import('../../package.json', { with: { type: 'json' } });
|
|
49
|
+
const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
|
|
79
50
|
let mdnsIpv4QueryInterval;
|
|
80
51
|
let mdnsIpv6QueryInterval;
|
|
81
52
|
let mdnsIpv4AdvertiseInterval;
|
|
82
53
|
let mdnsIpv6AdvertiseInterval;
|
|
83
54
|
let mdnsIpv4 = undefined;
|
|
84
55
|
let mdnsIpv6 = undefined;
|
|
85
|
-
/**
|
|
86
|
-
* Cleanup and log device information before exiting.
|
|
87
|
-
*/
|
|
88
56
|
async function cleanupAndLogAndExit() {
|
|
89
57
|
clearInterval(mdnsIpv4QueryInterval);
|
|
90
58
|
clearInterval(mdnsIpv6QueryInterval);
|
|
@@ -92,42 +60,48 @@ Examples:
|
|
|
92
60
|
clearInterval(mdnsIpv6AdvertiseInterval);
|
|
93
61
|
if (hasParameter('advertise')) {
|
|
94
62
|
if (mdnsIpv4)
|
|
95
|
-
advertise(mdnsIpv4, 0);
|
|
63
|
+
advertise(mdnsIpv4, 0);
|
|
96
64
|
if (mdnsIpv6)
|
|
97
|
-
advertise(mdnsIpv6, 0);
|
|
65
|
+
advertise(mdnsIpv6, 0);
|
|
98
66
|
}
|
|
99
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
67
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
100
68
|
mdnsIpv4?.stop();
|
|
101
69
|
mdnsIpv6?.stop();
|
|
102
70
|
mdnsIpv4?.logDevices();
|
|
103
71
|
mdnsIpv6?.logDevices();
|
|
104
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
72
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
105
73
|
}
|
|
106
74
|
const query = (mdns) => {
|
|
107
75
|
mdns.log.info('Sending mDNS query for common services...');
|
|
108
76
|
try {
|
|
109
77
|
mdns.sendQuery([
|
|
110
|
-
{ name: '_matterc._udp.local', type: 12
|
|
111
|
-
{ name: '_matter._tcp.local', type: 12
|
|
112
|
-
{ name: '_matterbridge._tcp.local', type: 12
|
|
113
|
-
{ name: '_home-assistant._tcp.local', type: 12
|
|
114
|
-
{ name: '_shelly._tcp.local', type: 12
|
|
115
|
-
{ name: '_mqtt._tcp.local', type: 12
|
|
116
|
-
{ name: '_http._tcp.local', type: 12
|
|
117
|
-
{ name: '_googlecast._tcp.local', type: 12
|
|
118
|
-
{ name: '
|
|
78
|
+
{ name: '_matterc._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
79
|
+
{ name: '_matter._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
80
|
+
{ name: '_matterbridge._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
81
|
+
{ name: '_home-assistant._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
82
|
+
{ name: '_shelly._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
83
|
+
{ name: '_mqtt._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
84
|
+
{ name: '_http._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
85
|
+
{ name: '_googlecast._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
86
|
+
{ name: '_airplay._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
87
|
+
{ name: '_amzn-alexa._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
88
|
+
{ name: '_companion-link._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
89
|
+
{ name: '_hap._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
90
|
+
{ name: '_hap._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
91
|
+
{ name: '_ipp._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
92
|
+
{ name: '_ipps._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
93
|
+
{ name: '_meshcop._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
94
|
+
{ name: '_printer._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
95
|
+
{ name: '_raop._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
96
|
+
{ name: '_sleep-proxy._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
97
|
+
{ name: '_ssh._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
98
|
+
{ name: '_services._dns-sd._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
119
99
|
]);
|
|
120
100
|
}
|
|
121
101
|
catch (error) {
|
|
122
102
|
mdns.log.error(`Error sending mDNS query: ${error.message}`);
|
|
123
103
|
}
|
|
124
104
|
};
|
|
125
|
-
/**
|
|
126
|
-
* Sends an mDNS advertisement for the HTTP service over UDP IPv4.
|
|
127
|
-
*
|
|
128
|
-
* @param {Mdns} mdns - The Mdns instance to use for sending the advertisement.
|
|
129
|
-
* @param {number} [ttl] - The time-to-live for the advertisement records. Defaults to 120 seconds. Send 0 for goodbye.
|
|
130
|
-
*/
|
|
131
105
|
const advertise = (mdns, ttl = 120) => {
|
|
132
106
|
mdns.log.info(`Sending mDNS advertisement for matterbridge service with TTL ${ttl ? ttl.toString() : 'goodbye'}...`);
|
|
133
107
|
const httpServiceType = '_http._tcp.local';
|
|
@@ -143,25 +117,17 @@ Examples:
|
|
|
143
117
|
const srvRdata = mdns.encodeSrvRdata(0, 0, port, hostName);
|
|
144
118
|
const txtRdata = mdns.encodeTxtRdata([`version=${pkg.version}`, 'path=/']);
|
|
145
119
|
const answers = [
|
|
146
|
-
|
|
147
|
-
{ name:
|
|
148
|
-
{ name:
|
|
149
|
-
{ name:
|
|
150
|
-
{ name:
|
|
151
|
-
|
|
152
|
-
{ name: httpInstanceName, rtype:
|
|
153
|
-
|
|
154
|
-
{ name: matterbridgeInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
|
|
155
|
-
// TXT record for the HTTP instance
|
|
156
|
-
{ name: httpInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
|
|
157
|
-
// TXT record for the matterbridge instance
|
|
158
|
-
{ name: matterbridgeInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
|
|
120
|
+
{ name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrHttpServiceTypeRdata },
|
|
121
|
+
{ name: httpServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrHttpInstanceRdata },
|
|
122
|
+
{ name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
|
|
123
|
+
{ name: matterbridgeServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeInstanceRdata },
|
|
124
|
+
{ name: httpInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
|
|
125
|
+
{ name: matterbridgeInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
|
|
126
|
+
{ name: httpInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
|
|
127
|
+
{ name: matterbridgeInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
|
|
159
128
|
];
|
|
160
|
-
// Always attempt to add both A and all AAAA records (best effort), regardless of the socket family.
|
|
161
129
|
const interfaces = os.networkInterfaces();
|
|
162
|
-
// Use specified interface name if provided
|
|
163
130
|
let interfaceInfos = mdns.interfaceName ? interfaces[mdns.interfaceName] : undefined;
|
|
164
|
-
// Find the first non-internal IPv4 and IPv6 addresses if interface name is not provided or not found
|
|
165
131
|
if (!interfaceInfos) {
|
|
166
132
|
interfaceInfos = [];
|
|
167
133
|
for (const name of Object.keys(interfaces)) {
|
|
@@ -172,15 +138,14 @@ Examples:
|
|
|
172
138
|
}
|
|
173
139
|
}
|
|
174
140
|
}
|
|
175
|
-
// Encode A and AAAA records for all non-internal addresses of the selected interface
|
|
176
141
|
for (const info of interfaceInfos) {
|
|
177
142
|
if (info.family === 'IPv4' && !info.internal) {
|
|
178
143
|
const ipv4 = info.address;
|
|
179
|
-
answers.push({ name: hostName, rtype: 1
|
|
144
|
+
answers.push({ name: hostName, rtype: 1, rclass: 1 | 32768, ttl, rdata: mdns.encodeA(ipv4) });
|
|
180
145
|
}
|
|
181
146
|
else if (info.family === 'IPv6' && !info.internal) {
|
|
182
147
|
const ipv6 = info.address;
|
|
183
|
-
answers.push({ name: hostName, rtype: 28
|
|
148
|
+
answers.push({ name: hostName, rtype: 28, rclass: 1 | 32768, ttl, rdata: mdns.encodeAAAA(ipv6) });
|
|
184
149
|
}
|
|
185
150
|
}
|
|
186
151
|
try {
|
|
@@ -194,15 +159,12 @@ Examples:
|
|
|
194
159
|
mdnsIpv4 = new Mdns('mDNS Server udp4', MDNS_MULTICAST_IPV4_ADDRESS, MDNS_MULTICAST_PORT, 'udp4', true, getParameter('interfaceName'), getParameter('ipv4InterfaceAddress') || '0.0.0.0', getParameter('outgoingIpv4InterfaceAddress'));
|
|
195
160
|
if (hasParameter('v') || hasParameter('verbose'))
|
|
196
161
|
mdnsIpv4.listNetworkInterfaces();
|
|
197
|
-
// Apply filters if any
|
|
198
162
|
const filters = getStringArrayParameter('filter');
|
|
199
163
|
if (filters)
|
|
200
164
|
mdnsIpv4.filters.push(...filters);
|
|
201
|
-
// Handle errors
|
|
202
165
|
mdnsIpv4.on('error', (err) => {
|
|
203
166
|
mdnsIpv4?.log.error(`mDNS udp4 Server error: ${err.message}\n${err.stack}`);
|
|
204
167
|
});
|
|
205
|
-
// Start the IPv4 mDNS server
|
|
206
168
|
mdnsIpv4.start();
|
|
207
169
|
mdnsIpv4.on('ready', (address) => {
|
|
208
170
|
mdnsIpv4?.socket.setMulticastLoopback(false);
|
|
@@ -221,15 +183,12 @@ Examples:
|
|
|
221
183
|
mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
|
|
222
184
|
if (hasParameter('v') || hasParameter('verbose'))
|
|
223
185
|
mdnsIpv6.listNetworkInterfaces();
|
|
224
|
-
// Apply filters if any
|
|
225
186
|
const filters = getStringArrayParameter('filter');
|
|
226
187
|
if (filters)
|
|
227
188
|
mdnsIpv6.filters.push(...filters);
|
|
228
|
-
// Handle errors
|
|
229
189
|
mdnsIpv6.on('error', (err) => {
|
|
230
190
|
mdnsIpv6?.log.error(`mDNS udp6 Server error: ${err.message}\n${err.stack}`);
|
|
231
191
|
});
|
|
232
|
-
// Start the IPv6 mDNS server
|
|
233
192
|
mdnsIpv6.start();
|
|
234
193
|
mdnsIpv6.on('ready', (address) => {
|
|
235
194
|
mdnsIpv6?.socket.setMulticastLoopback(false);
|
|
@@ -244,18 +203,15 @@ Examples:
|
|
|
244
203
|
}
|
|
245
204
|
});
|
|
246
205
|
}
|
|
247
|
-
// Handle Ctrl+C (SIGINT) and SIGTERM to stop and log devices
|
|
248
206
|
process.on('SIGINT', async () => {
|
|
249
207
|
await cleanupAndLogAndExit();
|
|
250
208
|
});
|
|
251
209
|
process.on('SIGTERM', async () => {
|
|
252
210
|
await cleanupAndLogAndExit();
|
|
253
211
|
});
|
|
254
|
-
// Exit after a timeout to avoid running indefinitely in test environments
|
|
255
212
|
if (!hasParameter('no-timeout')) {
|
|
256
213
|
setTimeout(async () => {
|
|
257
214
|
await cleanupAndLogAndExit();
|
|
258
|
-
}, 600000).unref();
|
|
215
|
+
}, 600000).unref();
|
|
259
216
|
}
|
|
260
217
|
}
|
|
261
|
-
//# sourceMappingURL=mb_mdns.js.map
|