@matterbridge/core 3.5.3 → 3.5.4-edge-20260211-1ea4e31
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/README.md +1 -1
- package/dist/cli.d.ts +0 -24
- package/dist/cli.js +1 -97
- package/dist/cliEmitter.d.ts +0 -36
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.d.ts +0 -42
- package/dist/cliHistory.js +0 -38
- 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 +1 -114
- package/dist/devices/airConditioner.d.ts +0 -75
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/basicVideoPlayer.d.ts +0 -58
- package/dist/devices/basicVideoPlayer.js +1 -56
- package/dist/devices/batteryStorage.d.ts +0 -43
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/castingVideoPlayer.d.ts +0 -63
- package/dist/devices/castingVideoPlayer.js +2 -65
- 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/dgram/export.d.ts +0 -1
- package/dist/dgram/export.js +0 -1
- package/dist/export.d.ts +0 -23
- package/dist/export.js +0 -28
- package/dist/frontend.d.ts +0 -187
- package/dist/frontend.js +38 -539
- package/dist/helpers.d.ts +0 -43
- package/dist/helpers.js +0 -86
- package/dist/jestutils/export.d.ts +0 -1
- package/dist/jestutils/export.js +0 -1
- package/dist/jestutils/jestHelpers.d.ts +0 -259
- package/dist/jestutils/jestHelpers.js +14 -395
- 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 +8 -356
- package/dist/matterbridge.d.ts +0 -389
- package/dist/matterbridge.js +48 -878
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
- package/dist/matterbridgeAccessoryPlatform.js +0 -50
- package/dist/matterbridgeBehaviors.d.ts +0 -24
- package/dist/matterbridgeBehaviors.js +5 -65
- package/dist/matterbridgeDeviceTypes.d.ts +0 -649
- package/dist/matterbridgeDeviceTypes.js +6 -673
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
- package/dist/matterbridgeDynamicPlatform.js +0 -50
- package/dist/matterbridgeEndpoint.d.ts +0 -1369
- package/dist/matterbridgeEndpoint.js +56 -1514
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
- package/dist/matterbridgeEndpointHelpers.js +20 -483
- package/dist/matterbridgeEndpointTypes.d.ts +0 -70
- package/dist/matterbridgeEndpointTypes.js +0 -25
- package/dist/matterbridgePlatform.d.ts +0 -434
- package/dist/matterbridgePlatform.js +1 -473
- package/dist/mb_coap.d.ts +0 -23
- package/dist/mb_coap.js +3 -41
- package/dist/mb_health.d.ts +0 -67
- package/dist/mb_health.js +0 -70
- package/dist/mb_mdns.d.ts +0 -23
- package/dist/mb_mdns.js +36 -94
- package/dist/pluginManager.d.ts +0 -307
- package/dist/pluginManager.js +6 -346
- package/dist/spawn.d.ts +0 -32
- package/dist/spawn.js +1 -71
- package/dist/utils/export.d.ts +0 -1
- package/dist/utils/export.js +0 -1
- package/package.json +27 -6
- 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/crypto/attestationDecoder.d.ts +0 -180
- package/dist/crypto/attestationDecoder.d.ts.map +0 -1
- package/dist/crypto/attestationDecoder.js +0 -176
- package/dist/crypto/attestationDecoder.js.map +0 -1
- package/dist/crypto/declarationDecoder.d.ts +0 -72
- package/dist/crypto/declarationDecoder.d.ts.map +0 -1
- package/dist/crypto/declarationDecoder.js +0 -241
- package/dist/crypto/declarationDecoder.js.map +0 -1
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts +0 -9
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts.map +0 -1
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js +0 -120
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js.map +0 -1
- package/dist/crypto/read-extensions.d.ts +0 -2
- package/dist/crypto/read-extensions.d.ts.map +0 -1
- package/dist/crypto/read-extensions.js +0 -81
- package/dist/crypto/read-extensions.js.map +0 -1
- package/dist/crypto/testData.d.ts +0 -31
- package/dist/crypto/testData.d.ts.map +0 -1
- package/dist/crypto/testData.js +0 -131
- package/dist/crypto/testData.js.map +0 -1
- package/dist/crypto/walk-der.d.ts +0 -2
- package/dist/crypto/walk-der.d.ts.map +0 -1
- package/dist/crypto/walk-der.js +0 -165
- package/dist/crypto/walk-der.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/basicVideoPlayer.d.ts.map +0 -1
- package/dist/devices/basicVideoPlayer.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/castingVideoPlayer.d.ts.map +0 -1
- package/dist/devices/castingVideoPlayer.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/export.d.ts.map +0 -1
- package/dist/dgram/export.js.map +0 -1
- package/dist/export.d.ts.map +0 -1
- package/dist/export.js.map +0 -1
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.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/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/mb_coap.d.ts.map +0 -1
- package/dist/mb_coap.js.map +0 -1
- package/dist/mb_health.d.ts.map +0 -1
- package/dist/mb_health.js.map +0 -1
- package/dist/mb_mdns.d.ts.map +0 -1
- package/dist/mb_mdns.js.map +0 -1
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/spawn.d.ts.map +0 -1
- package/dist/spawn.js.map +0 -1
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/workers/brand.d.ts +0 -25
- package/dist/workers/brand.d.ts.map +0 -1
- package/dist/workers/brand.extend.d.ts +0 -10
- package/dist/workers/brand.extend.d.ts.map +0 -1
- package/dist/workers/brand.extend.js +0 -15
- package/dist/workers/brand.extend.js.map +0 -1
- package/dist/workers/brand.invalid.d.ts +0 -9
- package/dist/workers/brand.invalid.d.ts.map +0 -1
- package/dist/workers/brand.invalid.js +0 -19
- package/dist/workers/brand.invalid.js.map +0 -1
- package/dist/workers/brand.js +0 -67
- package/dist/workers/brand.js.map +0 -1
- package/dist/workers/clusterTypes.d.ts +0 -47
- package/dist/workers/clusterTypes.d.ts.map +0 -1
- package/dist/workers/clusterTypes.js +0 -57
- package/dist/workers/clusterTypes.js.map +0 -1
- package/dist/workers/frontendWorker.d.ts +0 -2
- package/dist/workers/frontendWorker.d.ts.map +0 -1
- package/dist/workers/frontendWorker.js +0 -90
- package/dist/workers/frontendWorker.js.map +0 -1
- package/dist/workers/helloWorld.d.ts +0 -2
- package/dist/workers/helloWorld.d.ts.map +0 -1
- package/dist/workers/helloWorld.js +0 -135
- package/dist/workers/helloWorld.js.map +0 -1
- package/dist/workers/matterWorker.d.ts +0 -2
- package/dist/workers/matterWorker.d.ts.map +0 -1
- package/dist/workers/matterWorker.js +0 -104
- package/dist/workers/matterWorker.js.map +0 -1
- package/dist/workers/matterbridgeWorker.d.ts +0 -2
- package/dist/workers/matterbridgeWorker.d.ts.map +0 -1
- package/dist/workers/matterbridgeWorker.js +0 -75
- package/dist/workers/matterbridgeWorker.js.map +0 -1
- package/dist/workers/messageLab.d.ts +0 -134
- package/dist/workers/messageLab.d.ts.map +0 -1
- package/dist/workers/messageLab.js +0 -129
- package/dist/workers/messageLab.js.map +0 -1
- package/dist/workers/testWorker.d.ts +0 -2
- package/dist/workers/testWorker.d.ts.map +0 -1
- package/dist/workers/testWorker.js +0 -45
- package/dist/workers/testWorker.js.map +0 -1
- package/dist/workers/usage.d.ts +0 -19
- package/dist/workers/usage.d.ts.map +0 -1
- package/dist/workers/usage.js +0 -140
- package/dist/workers/usage.js.map +0 -1
- package/dist/workers/workerManager.d.ts +0 -115
- package/dist/workers/workerManager.d.ts.map +0 -1
- package/dist/workers/workerManager.js +0 -464
- package/dist/workers/workerManager.js.map +0 -1
- package/dist/workers/workerServer.d.ts +0 -126
- package/dist/workers/workerServer.d.ts.map +0 -1
- package/dist/workers/workerServer.js +0 -340
- package/dist/workers/workerServer.js.map +0 -1
- package/dist/workers/workerTypes.d.ts +0 -23
- package/dist/workers/workerTypes.d.ts.map +0 -1
- package/dist/workers/workerTypes.js +0 -3
- package/dist/workers/workerTypes.js.map +0 -1
package/dist/mb_coap.d.ts
CHANGED
|
@@ -1,24 +1 @@
|
|
|
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
1
|
export {};
|
|
24
|
-
//# sourceMappingURL=mb_coap.d.ts.map
|
package/dist/mb_coap.js
CHANGED
|
@@ -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
|
package/dist/mb_health.d.ts
CHANGED
|
@@ -1,77 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the bin mb_health to check the Matterbridge health endpoint.
|
|
3
|
-
* @file src/mb_health.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2026-01-28
|
|
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
|
-
/**
|
|
24
|
-
* Checks the Matterbridge health endpoint.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} url The URL to fetch.
|
|
27
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
28
|
-
* @returns {Promise<boolean>} True if the endpoint responds with a 2xx status code.
|
|
29
|
-
*/
|
|
30
1
|
export declare function checkHealth(url: string, timeoutMs: number): Promise<boolean>;
|
|
31
|
-
/**
|
|
32
|
-
* Fetches the health endpoint response.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} url The URL to fetch.
|
|
35
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
36
|
-
* @returns {Promise<{ ok: boolean; statusCode: number; body: string; json?: unknown }>} The response details.
|
|
37
|
-
*/
|
|
38
2
|
export declare function fetchHealth(url: string, timeoutMs: number): Promise<{
|
|
39
3
|
ok: boolean;
|
|
40
4
|
statusCode: number;
|
|
41
5
|
body: string;
|
|
42
6
|
json?: unknown;
|
|
43
7
|
}>;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the exit code for the health check.
|
|
46
|
-
*
|
|
47
|
-
* @param {string} url The URL to fetch.
|
|
48
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
49
|
-
* @returns {Promise<number>} Exit code (0 if ok, 1 otherwise).
|
|
50
|
-
*/
|
|
51
8
|
export declare function mbHealthExitCode(url: string, timeoutMs: number): Promise<number>;
|
|
52
|
-
/**
|
|
53
|
-
* CLI runner for mb_health.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} url The URL to fetch.
|
|
56
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
57
|
-
* @param {(code: number) => never | void} exitFn Exit function (defaults to process.exit).
|
|
58
|
-
* @returns {Promise<void>} Resolves when done.
|
|
59
|
-
*/
|
|
60
9
|
export declare function mbHealthCli(url: string, timeoutMs: number, exitFn?: (code: number) => never | void): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Default CLI entrypoint for `mb_health`.
|
|
63
|
-
*
|
|
64
|
-
* @param {(code: number) => never | void} exitFn Exit function (defaults to process.exit).
|
|
65
|
-
* @returns {Promise<void>} Resolves when done.
|
|
66
|
-
*/
|
|
67
10
|
export declare function mbHealthMain(exitFn?: (code: number) => never | void): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Docker HEALTHCHECK usage:
|
|
70
|
-
*
|
|
71
|
-
* ```dockerfile
|
|
72
|
-
* # After installing the matterbridge package globally (so the `mb_health` bin is on PATH)
|
|
73
|
-
* HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=5 \
|
|
74
|
-
* CMD mb_health || exit 1
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
//# sourceMappingURL=mb_health.d.ts.map
|
package/dist/mb_health.js
CHANGED
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the bin mb_health to check the Matterbridge health endpoint.
|
|
3
|
-
* @file src/mb_health.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2026-01-28
|
|
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 http from 'node:http';
|
|
24
2
|
import https from 'node:https';
|
|
25
|
-
/**
|
|
26
|
-
* Checks the Matterbridge health endpoint.
|
|
27
|
-
*
|
|
28
|
-
* @param {string} url The URL to fetch.
|
|
29
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
30
|
-
* @returns {Promise<boolean>} True if the endpoint responds with a 2xx status code.
|
|
31
|
-
*/
|
|
32
3
|
export function checkHealth(url, timeoutMs) {
|
|
33
4
|
return fetchHealth(url, timeoutMs)
|
|
34
5
|
.then(({ ok }) => ok)
|
|
35
6
|
.catch(() => false);
|
|
36
7
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Fetches the health endpoint response.
|
|
39
|
-
*
|
|
40
|
-
* @param {string} url The URL to fetch.
|
|
41
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
42
|
-
* @returns {Promise<{ ok: boolean; statusCode: number; body: string; json?: unknown }>} The response details.
|
|
43
|
-
*/
|
|
44
8
|
export function fetchHealth(url, timeoutMs) {
|
|
45
9
|
return new Promise((resolve) => {
|
|
46
10
|
const parsedUrl = new URL(url);
|
|
@@ -86,13 +50,6 @@ export function fetchHealth(url, timeoutMs) {
|
|
|
86
50
|
request.end();
|
|
87
51
|
});
|
|
88
52
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Returns the exit code for the health check.
|
|
91
|
-
*
|
|
92
|
-
* @param {string} url The URL to fetch.
|
|
93
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
94
|
-
* @returns {Promise<number>} Exit code (0 if ok, 1 otherwise).
|
|
95
|
-
*/
|
|
96
53
|
export async function mbHealthExitCode(url, timeoutMs) {
|
|
97
54
|
try {
|
|
98
55
|
const { ok } = await fetchHealth(url, timeoutMs);
|
|
@@ -102,46 +59,19 @@ export async function mbHealthExitCode(url, timeoutMs) {
|
|
|
102
59
|
return 1;
|
|
103
60
|
}
|
|
104
61
|
}
|
|
105
|
-
/**
|
|
106
|
-
* CLI runner for mb_health.
|
|
107
|
-
*
|
|
108
|
-
* @param {string} url The URL to fetch.
|
|
109
|
-
* @param {number} timeoutMs The timeout in milliseconds.
|
|
110
|
-
* @param {(code: number) => never | void} exitFn Exit function (defaults to process.exit).
|
|
111
|
-
* @returns {Promise<void>} Resolves when done.
|
|
112
|
-
*/
|
|
113
62
|
export async function mbHealthCli(url, timeoutMs, exitFn = process.exit) {
|
|
114
63
|
const { ok, statusCode, body, json } = await fetchHealth(url, timeoutMs);
|
|
115
64
|
if (json !== undefined) {
|
|
116
|
-
// eslint-disable-next-line no-console
|
|
117
65
|
console.log(JSON.stringify(json, null, 2));
|
|
118
66
|
}
|
|
119
67
|
else if (body) {
|
|
120
|
-
// eslint-disable-next-line no-console
|
|
121
68
|
console.log(body);
|
|
122
69
|
}
|
|
123
70
|
else {
|
|
124
|
-
// eslint-disable-next-line no-console
|
|
125
71
|
console.log(JSON.stringify({ ok, statusCode }, null, 2));
|
|
126
72
|
}
|
|
127
73
|
exitFn(ok ? 0 : 1);
|
|
128
74
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Default CLI entrypoint for `mb_health`.
|
|
131
|
-
*
|
|
132
|
-
* @param {(code: number) => never | void} exitFn Exit function (defaults to process.exit).
|
|
133
|
-
* @returns {Promise<void>} Resolves when done.
|
|
134
|
-
*/
|
|
135
75
|
export async function mbHealthMain(exitFn = process.exit) {
|
|
136
76
|
await mbHealthCli('http://localhost:8283/health', 5000, exitFn);
|
|
137
77
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Docker HEALTHCHECK usage:
|
|
140
|
-
*
|
|
141
|
-
* ```dockerfile
|
|
142
|
-
* # After installing the matterbridge package globally (so the `mb_health` bin is on PATH)
|
|
143
|
-
* HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=5 \
|
|
144
|
-
* CMD mb_health || exit 1
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
//# sourceMappingURL=mb_health.js.map
|
package/dist/mb_mdns.d.ts
CHANGED
|
@@ -1,24 +1 @@
|
|
|
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
|
export {};
|
|
24
|
-
//# sourceMappingURL=mb_mdns.d.ts.map
|
package/dist/mb_mdns.js
CHANGED
|
@@ -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 ::).
|
|
@@ -75,10 +48,8 @@ Examples:
|
|
|
75
48
|
# Query each 5s and listen for _matterbridge._tcp.local service records
|
|
76
49
|
mb_mdns --query 5000 --filter _matterbridge._tcp.local
|
|
77
50
|
`);
|
|
78
|
-
// eslint-disable-next-line n/no-process-exit
|
|
79
51
|
process.exit(0);
|
|
80
52
|
}
|
|
81
|
-
// Dynamic JSON import (Node >= 20) with import attributes
|
|
82
53
|
const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
|
|
83
54
|
let mdnsIpv4QueryInterval;
|
|
84
55
|
let mdnsIpv6QueryInterval;
|
|
@@ -86,9 +57,6 @@ Examples:
|
|
|
86
57
|
let mdnsIpv6AdvertiseInterval;
|
|
87
58
|
let mdnsIpv4 = undefined;
|
|
88
59
|
let mdnsIpv6 = undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Cleanup and log device information before exiting.
|
|
91
|
-
*/
|
|
92
60
|
async function cleanupAndLogAndExit() {
|
|
93
61
|
clearInterval(mdnsIpv4QueryInterval);
|
|
94
62
|
clearInterval(mdnsIpv6QueryInterval);
|
|
@@ -96,54 +64,48 @@ Examples:
|
|
|
96
64
|
clearInterval(mdnsIpv6AdvertiseInterval);
|
|
97
65
|
if (hasParameter('advertise')) {
|
|
98
66
|
if (mdnsIpv4)
|
|
99
|
-
advertise(mdnsIpv4, 0);
|
|
67
|
+
advertise(mdnsIpv4, 0);
|
|
100
68
|
if (mdnsIpv6)
|
|
101
|
-
advertise(mdnsIpv6, 0);
|
|
69
|
+
advertise(mdnsIpv6, 0);
|
|
102
70
|
}
|
|
103
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
71
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
104
72
|
mdnsIpv4?.stop();
|
|
105
73
|
mdnsIpv6?.stop();
|
|
106
74
|
mdnsIpv4?.logDevices();
|
|
107
75
|
mdnsIpv6?.logDevices();
|
|
108
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
76
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
109
77
|
}
|
|
110
78
|
const query = (mdns) => {
|
|
111
79
|
mdns.log.info('Sending mDNS query for common services...');
|
|
112
80
|
try {
|
|
113
81
|
mdns.sendQuery([
|
|
114
|
-
{ name: '_matterc._udp.local', type: 12
|
|
115
|
-
{ name: '_matter._tcp.local', type: 12
|
|
116
|
-
{ name: '_matterbridge._tcp.local', type: 12
|
|
117
|
-
{ name: '_home-assistant._tcp.local', type: 12
|
|
118
|
-
{ name: '_shelly._tcp.local', type: 12
|
|
119
|
-
{ name: '_mqtt._tcp.local', type: 12
|
|
120
|
-
{ name: '_http._tcp.local', type: 12
|
|
121
|
-
{ name: '_googlecast._tcp.local', type: 12
|
|
122
|
-
{ name: '_airplay._tcp.local', type: 12
|
|
123
|
-
{ name: '_amzn-alexa._tcp.local', type: 12
|
|
124
|
-
{ name: '_companion-link._tcp.local', type: 12
|
|
125
|
-
{ name: '_hap._tcp.local', type: 12
|
|
126
|
-
{ name: '_hap._udp.local', type: 12
|
|
127
|
-
{ name: '_ipp._tcp.local', type: 12
|
|
128
|
-
{ name: '_ipps._tcp.local', type: 12
|
|
129
|
-
{ name: '_meshcop._tcp.local', type: 12
|
|
130
|
-
{ name: '_printer._tcp.local', type: 12
|
|
131
|
-
{ name: '_raop._tcp.local', type: 12
|
|
132
|
-
{ name: '_sleep-proxy._tcp.local', type: 12
|
|
133
|
-
{ name: '_ssh._tcp.local', type: 12
|
|
134
|
-
{ name: '_services._dns-sd._udp.local', type: 12
|
|
82
|
+
{ name: '_matterc._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
83
|
+
{ name: '_matter._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
84
|
+
{ name: '_matterbridge._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
85
|
+
{ name: '_home-assistant._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
86
|
+
{ name: '_shelly._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
87
|
+
{ name: '_mqtt._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
88
|
+
{ name: '_http._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
89
|
+
{ name: '_googlecast._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
90
|
+
{ name: '_airplay._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
91
|
+
{ name: '_amzn-alexa._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
92
|
+
{ name: '_companion-link._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
93
|
+
{ name: '_hap._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
94
|
+
{ name: '_hap._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
95
|
+
{ name: '_ipp._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
96
|
+
{ name: '_ipps._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
97
|
+
{ name: '_meshcop._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
98
|
+
{ name: '_printer._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
99
|
+
{ name: '_raop._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
100
|
+
{ name: '_sleep-proxy._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
101
|
+
{ name: '_ssh._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
102
|
+
{ name: '_services._dns-sd._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
135
103
|
]);
|
|
136
104
|
}
|
|
137
105
|
catch (error) {
|
|
138
106
|
mdns.log.error(`Error sending mDNS query: ${error.message}`);
|
|
139
107
|
}
|
|
140
108
|
};
|
|
141
|
-
/**
|
|
142
|
-
* Sends an mDNS advertisement for the HTTP service over UDP IPv4.
|
|
143
|
-
*
|
|
144
|
-
* @param {Mdns} mdns - The Mdns instance to use for sending the advertisement.
|
|
145
|
-
* @param {number} [ttl] - The time-to-live for the advertisement records. Defaults to 120 seconds. Send 0 for goodbye.
|
|
146
|
-
*/
|
|
147
109
|
const advertise = (mdns, ttl = 120) => {
|
|
148
110
|
mdns.log.info(`Sending mDNS advertisement for matterbridge service with TTL ${ttl ? ttl.toString() : 'goodbye'}...`);
|
|
149
111
|
const httpServiceType = '_http._tcp.local';
|
|
@@ -159,25 +121,17 @@ Examples:
|
|
|
159
121
|
const srvRdata = mdns.encodeSrvRdata(0, 0, port, hostName);
|
|
160
122
|
const txtRdata = mdns.encodeTxtRdata([`version=${pkg.version}`, 'path=/']);
|
|
161
123
|
const answers = [
|
|
162
|
-
|
|
163
|
-
{ name:
|
|
164
|
-
{ name:
|
|
165
|
-
{ name:
|
|
166
|
-
{ name:
|
|
167
|
-
|
|
168
|
-
{ name: httpInstanceName, rtype:
|
|
169
|
-
|
|
170
|
-
{ name: matterbridgeInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
|
|
171
|
-
// TXT record for the HTTP instance
|
|
172
|
-
{ name: httpInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
|
|
173
|
-
// TXT record for the matterbridge instance
|
|
174
|
-
{ name: matterbridgeInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
|
|
124
|
+
{ name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrHttpServiceTypeRdata },
|
|
125
|
+
{ name: httpServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrHttpInstanceRdata },
|
|
126
|
+
{ name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
|
|
127
|
+
{ name: matterbridgeServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeInstanceRdata },
|
|
128
|
+
{ name: httpInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
|
|
129
|
+
{ name: matterbridgeInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
|
|
130
|
+
{ name: httpInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
|
|
131
|
+
{ name: matterbridgeInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
|
|
175
132
|
];
|
|
176
|
-
// Always attempt to add both A and all AAAA records (best effort), regardless of the socket family.
|
|
177
133
|
const interfaces = os.networkInterfaces();
|
|
178
|
-
// Use specified interface name if provided
|
|
179
134
|
let interfaceInfos = mdns.interfaceName ? interfaces[mdns.interfaceName] : undefined;
|
|
180
|
-
// Find the first non-internal IPv4 and IPv6 addresses if interface name is not provided or not found
|
|
181
135
|
if (!interfaceInfos) {
|
|
182
136
|
interfaceInfos = [];
|
|
183
137
|
for (const name of Object.keys(interfaces)) {
|
|
@@ -188,15 +142,14 @@ Examples:
|
|
|
188
142
|
}
|
|
189
143
|
}
|
|
190
144
|
}
|
|
191
|
-
// Encode A and AAAA records for all non-internal addresses of the selected interface
|
|
192
145
|
for (const info of interfaceInfos) {
|
|
193
146
|
if (info.family === 'IPv4' && !info.internal) {
|
|
194
147
|
const ipv4 = info.address;
|
|
195
|
-
answers.push({ name: hostName, rtype: 1
|
|
148
|
+
answers.push({ name: hostName, rtype: 1, rclass: 1 | 32768, ttl, rdata: mdns.encodeA(ipv4) });
|
|
196
149
|
}
|
|
197
150
|
else if (info.family === 'IPv6' && !info.internal) {
|
|
198
151
|
const ipv6 = info.address;
|
|
199
|
-
answers.push({ name: hostName, rtype: 28
|
|
152
|
+
answers.push({ name: hostName, rtype: 28, rclass: 1 | 32768, ttl, rdata: mdns.encodeAAAA(ipv6) });
|
|
200
153
|
}
|
|
201
154
|
}
|
|
202
155
|
try {
|
|
@@ -210,19 +163,15 @@ Examples:
|
|
|
210
163
|
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'));
|
|
211
164
|
if (hasParameter('v') || hasParameter('verbose'))
|
|
212
165
|
mdnsIpv4.listNetworkInterfaces();
|
|
213
|
-
// Apply filters if any
|
|
214
166
|
const filters = getStringArrayParameter('filter');
|
|
215
167
|
if (filters)
|
|
216
168
|
mdnsIpv4.filters.push(...filters);
|
|
217
|
-
// Apply ip filters if any
|
|
218
169
|
const ipFilters = getStringArrayParameter('ip-filter');
|
|
219
170
|
if (ipFilters)
|
|
220
171
|
mdnsIpv4.ipFilters.push(...ipFilters);
|
|
221
|
-
// Handle errors
|
|
222
172
|
mdnsIpv4.on('error', (err) => {
|
|
223
173
|
mdnsIpv4?.log.error(`mDNS udp4 Server error: ${err.message}\n${err.stack}`);
|
|
224
174
|
});
|
|
225
|
-
// Start the IPv4 mDNS server
|
|
226
175
|
mdnsIpv4.start();
|
|
227
176
|
mdnsIpv4.on('ready', (address) => {
|
|
228
177
|
mdnsIpv4?.socket.setMulticastLoopback(false);
|
|
@@ -241,19 +190,15 @@ Examples:
|
|
|
241
190
|
mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
|
|
242
191
|
if (hasParameter('v') || hasParameter('verbose'))
|
|
243
192
|
mdnsIpv6.listNetworkInterfaces();
|
|
244
|
-
// Apply filters if any
|
|
245
193
|
const filters = getStringArrayParameter('filter');
|
|
246
194
|
if (filters)
|
|
247
195
|
mdnsIpv6.filters.push(...filters);
|
|
248
|
-
// Apply ip filters if any
|
|
249
196
|
const ipFilters = getStringArrayParameter('ip-filter');
|
|
250
197
|
if (ipFilters)
|
|
251
198
|
mdnsIpv6.ipFilters.push(...ipFilters);
|
|
252
|
-
// Handle errors
|
|
253
199
|
mdnsIpv6.on('error', (err) => {
|
|
254
200
|
mdnsIpv6?.log.error(`mDNS udp6 Server error: ${err.message}\n${err.stack}`);
|
|
255
201
|
});
|
|
256
|
-
// Start the IPv6 mDNS server
|
|
257
202
|
mdnsIpv6.start();
|
|
258
203
|
mdnsIpv6.on('ready', (address) => {
|
|
259
204
|
mdnsIpv6?.socket.setMulticastLoopback(false);
|
|
@@ -268,18 +213,15 @@ Examples:
|
|
|
268
213
|
}
|
|
269
214
|
});
|
|
270
215
|
}
|
|
271
|
-
// Handle Ctrl+C (SIGINT) and SIGTERM to stop and log devices
|
|
272
216
|
process.on('SIGINT', async () => {
|
|
273
217
|
await cleanupAndLogAndExit();
|
|
274
218
|
});
|
|
275
219
|
process.on('SIGTERM', async () => {
|
|
276
220
|
await cleanupAndLogAndExit();
|
|
277
221
|
});
|
|
278
|
-
// Exit after a timeout to avoid running indefinitely in test environments
|
|
279
222
|
if (!hasParameter('no-timeout')) {
|
|
280
223
|
setTimeout(async () => {
|
|
281
224
|
await cleanupAndLogAndExit();
|
|
282
|
-
}, 600000).unref();
|
|
225
|
+
}, 600000).unref();
|
|
283
226
|
}
|
|
284
227
|
}
|
|
285
|
-
//# sourceMappingURL=mb_mdns.js.map
|