@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.
Files changed (294) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.d.ts +0 -24
  3. package/dist/cli.js +1 -97
  4. package/dist/cliEmitter.d.ts +0 -36
  5. package/dist/cliEmitter.js +0 -37
  6. package/dist/cliHistory.d.ts +0 -42
  7. package/dist/cliHistory.js +0 -38
  8. package/dist/clusters/export.d.ts +0 -1
  9. package/dist/clusters/export.js +0 -2
  10. package/dist/deviceManager.d.ts +0 -108
  11. package/dist/deviceManager.js +1 -114
  12. package/dist/devices/airConditioner.d.ts +0 -75
  13. package/dist/devices/airConditioner.js +0 -57
  14. package/dist/devices/basicVideoPlayer.d.ts +0 -58
  15. package/dist/devices/basicVideoPlayer.js +1 -56
  16. package/dist/devices/batteryStorage.d.ts +0 -43
  17. package/dist/devices/batteryStorage.js +1 -48
  18. package/dist/devices/castingVideoPlayer.d.ts +0 -63
  19. package/dist/devices/castingVideoPlayer.js +2 -65
  20. package/dist/devices/cooktop.d.ts +0 -55
  21. package/dist/devices/cooktop.js +0 -56
  22. package/dist/devices/dishwasher.d.ts +0 -55
  23. package/dist/devices/dishwasher.js +0 -57
  24. package/dist/devices/evse.d.ts +0 -57
  25. package/dist/devices/evse.js +10 -74
  26. package/dist/devices/export.d.ts +0 -1
  27. package/dist/devices/export.js +0 -5
  28. package/dist/devices/extractorHood.d.ts +0 -41
  29. package/dist/devices/extractorHood.js +0 -43
  30. package/dist/devices/heatPump.d.ts +0 -43
  31. package/dist/devices/heatPump.js +2 -50
  32. package/dist/devices/laundryDryer.d.ts +0 -58
  33. package/dist/devices/laundryDryer.js +3 -62
  34. package/dist/devices/laundryWasher.d.ts +0 -64
  35. package/dist/devices/laundryWasher.js +4 -70
  36. package/dist/devices/microwaveOven.d.ts +1 -77
  37. package/dist/devices/microwaveOven.js +5 -88
  38. package/dist/devices/oven.d.ts +0 -82
  39. package/dist/devices/oven.js +0 -85
  40. package/dist/devices/refrigerator.d.ts +0 -100
  41. package/dist/devices/refrigerator.js +0 -102
  42. package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
  43. package/dist/devices/roboticVacuumCleaner.js +9 -100
  44. package/dist/devices/solarPower.d.ts +0 -36
  45. package/dist/devices/solarPower.js +0 -38
  46. package/dist/devices/speaker.d.ts +0 -79
  47. package/dist/devices/speaker.js +0 -84
  48. package/dist/devices/temperatureControl.d.ts +0 -21
  49. package/dist/devices/temperatureControl.js +3 -24
  50. package/dist/devices/waterHeater.d.ts +0 -74
  51. package/dist/devices/waterHeater.js +2 -82
  52. package/dist/dgram/export.d.ts +0 -1
  53. package/dist/dgram/export.js +0 -1
  54. package/dist/export.d.ts +0 -23
  55. package/dist/export.js +0 -28
  56. package/dist/frontend.d.ts +0 -187
  57. package/dist/frontend.js +38 -539
  58. package/dist/helpers.d.ts +0 -43
  59. package/dist/helpers.js +0 -86
  60. package/dist/jestutils/export.d.ts +0 -1
  61. package/dist/jestutils/export.js +0 -1
  62. package/dist/jestutils/jestHelpers.d.ts +0 -259
  63. package/dist/jestutils/jestHelpers.js +14 -395
  64. package/dist/matter/behaviors.d.ts +0 -1
  65. package/dist/matter/behaviors.js +0 -2
  66. package/dist/matter/clusters.d.ts +0 -1
  67. package/dist/matter/clusters.js +0 -2
  68. package/dist/matter/devices.d.ts +0 -1
  69. package/dist/matter/devices.js +0 -2
  70. package/dist/matter/endpoints.d.ts +0 -1
  71. package/dist/matter/endpoints.js +0 -2
  72. package/dist/matter/export.d.ts +0 -1
  73. package/dist/matter/export.js +0 -2
  74. package/dist/matter/types.d.ts +0 -1
  75. package/dist/matter/types.js +0 -2
  76. package/dist/matterNode.d.ts +0 -258
  77. package/dist/matterNode.js +8 -356
  78. package/dist/matterbridge.d.ts +0 -389
  79. package/dist/matterbridge.js +48 -878
  80. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  81. package/dist/matterbridgeAccessoryPlatform.js +0 -50
  82. package/dist/matterbridgeBehaviors.d.ts +0 -24
  83. package/dist/matterbridgeBehaviors.js +5 -65
  84. package/dist/matterbridgeDeviceTypes.d.ts +0 -649
  85. package/dist/matterbridgeDeviceTypes.js +6 -673
  86. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  87. package/dist/matterbridgeDynamicPlatform.js +0 -50
  88. package/dist/matterbridgeEndpoint.d.ts +0 -1369
  89. package/dist/matterbridgeEndpoint.js +56 -1514
  90. package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
  91. package/dist/matterbridgeEndpointHelpers.js +20 -483
  92. package/dist/matterbridgeEndpointTypes.d.ts +0 -70
  93. package/dist/matterbridgeEndpointTypes.js +0 -25
  94. package/dist/matterbridgePlatform.d.ts +0 -434
  95. package/dist/matterbridgePlatform.js +1 -473
  96. package/dist/mb_coap.d.ts +0 -23
  97. package/dist/mb_coap.js +3 -41
  98. package/dist/mb_health.d.ts +0 -67
  99. package/dist/mb_health.js +0 -70
  100. package/dist/mb_mdns.d.ts +0 -23
  101. package/dist/mb_mdns.js +36 -94
  102. package/dist/pluginManager.d.ts +0 -307
  103. package/dist/pluginManager.js +6 -346
  104. package/dist/spawn.d.ts +0 -32
  105. package/dist/spawn.js +1 -71
  106. package/dist/utils/export.d.ts +0 -1
  107. package/dist/utils/export.js +0 -1
  108. package/package.json +27 -6
  109. package/dist/cli.d.ts.map +0 -1
  110. package/dist/cli.js.map +0 -1
  111. package/dist/cliEmitter.d.ts.map +0 -1
  112. package/dist/cliEmitter.js.map +0 -1
  113. package/dist/cliHistory.d.ts.map +0 -1
  114. package/dist/cliHistory.js.map +0 -1
  115. package/dist/clusters/export.d.ts.map +0 -1
  116. package/dist/clusters/export.js.map +0 -1
  117. package/dist/crypto/attestationDecoder.d.ts +0 -180
  118. package/dist/crypto/attestationDecoder.d.ts.map +0 -1
  119. package/dist/crypto/attestationDecoder.js +0 -176
  120. package/dist/crypto/attestationDecoder.js.map +0 -1
  121. package/dist/crypto/declarationDecoder.d.ts +0 -72
  122. package/dist/crypto/declarationDecoder.d.ts.map +0 -1
  123. package/dist/crypto/declarationDecoder.js +0 -241
  124. package/dist/crypto/declarationDecoder.js.map +0 -1
  125. package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts +0 -9
  126. package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts.map +0 -1
  127. package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js +0 -120
  128. package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js.map +0 -1
  129. package/dist/crypto/read-extensions.d.ts +0 -2
  130. package/dist/crypto/read-extensions.d.ts.map +0 -1
  131. package/dist/crypto/read-extensions.js +0 -81
  132. package/dist/crypto/read-extensions.js.map +0 -1
  133. package/dist/crypto/testData.d.ts +0 -31
  134. package/dist/crypto/testData.d.ts.map +0 -1
  135. package/dist/crypto/testData.js +0 -131
  136. package/dist/crypto/testData.js.map +0 -1
  137. package/dist/crypto/walk-der.d.ts +0 -2
  138. package/dist/crypto/walk-der.d.ts.map +0 -1
  139. package/dist/crypto/walk-der.js +0 -165
  140. package/dist/crypto/walk-der.js.map +0 -1
  141. package/dist/deviceManager.d.ts.map +0 -1
  142. package/dist/deviceManager.js.map +0 -1
  143. package/dist/devices/airConditioner.d.ts.map +0 -1
  144. package/dist/devices/airConditioner.js.map +0 -1
  145. package/dist/devices/basicVideoPlayer.d.ts.map +0 -1
  146. package/dist/devices/basicVideoPlayer.js.map +0 -1
  147. package/dist/devices/batteryStorage.d.ts.map +0 -1
  148. package/dist/devices/batteryStorage.js.map +0 -1
  149. package/dist/devices/castingVideoPlayer.d.ts.map +0 -1
  150. package/dist/devices/castingVideoPlayer.js.map +0 -1
  151. package/dist/devices/cooktop.d.ts.map +0 -1
  152. package/dist/devices/cooktop.js.map +0 -1
  153. package/dist/devices/dishwasher.d.ts.map +0 -1
  154. package/dist/devices/dishwasher.js.map +0 -1
  155. package/dist/devices/evse.d.ts.map +0 -1
  156. package/dist/devices/evse.js.map +0 -1
  157. package/dist/devices/export.d.ts.map +0 -1
  158. package/dist/devices/export.js.map +0 -1
  159. package/dist/devices/extractorHood.d.ts.map +0 -1
  160. package/dist/devices/extractorHood.js.map +0 -1
  161. package/dist/devices/heatPump.d.ts.map +0 -1
  162. package/dist/devices/heatPump.js.map +0 -1
  163. package/dist/devices/laundryDryer.d.ts.map +0 -1
  164. package/dist/devices/laundryDryer.js.map +0 -1
  165. package/dist/devices/laundryWasher.d.ts.map +0 -1
  166. package/dist/devices/laundryWasher.js.map +0 -1
  167. package/dist/devices/microwaveOven.d.ts.map +0 -1
  168. package/dist/devices/microwaveOven.js.map +0 -1
  169. package/dist/devices/oven.d.ts.map +0 -1
  170. package/dist/devices/oven.js.map +0 -1
  171. package/dist/devices/refrigerator.d.ts.map +0 -1
  172. package/dist/devices/refrigerator.js.map +0 -1
  173. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  174. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  175. package/dist/devices/solarPower.d.ts.map +0 -1
  176. package/dist/devices/solarPower.js.map +0 -1
  177. package/dist/devices/speaker.d.ts.map +0 -1
  178. package/dist/devices/speaker.js.map +0 -1
  179. package/dist/devices/temperatureControl.d.ts.map +0 -1
  180. package/dist/devices/temperatureControl.js.map +0 -1
  181. package/dist/devices/waterHeater.d.ts.map +0 -1
  182. package/dist/devices/waterHeater.js.map +0 -1
  183. package/dist/dgram/export.d.ts.map +0 -1
  184. package/dist/dgram/export.js.map +0 -1
  185. package/dist/export.d.ts.map +0 -1
  186. package/dist/export.js.map +0 -1
  187. package/dist/frontend.d.ts.map +0 -1
  188. package/dist/frontend.js.map +0 -1
  189. package/dist/helpers.d.ts.map +0 -1
  190. package/dist/helpers.js.map +0 -1
  191. package/dist/jestutils/export.d.ts.map +0 -1
  192. package/dist/jestutils/export.js.map +0 -1
  193. package/dist/jestutils/jestHelpers.d.ts.map +0 -1
  194. package/dist/jestutils/jestHelpers.js.map +0 -1
  195. package/dist/matter/behaviors.d.ts.map +0 -1
  196. package/dist/matter/behaviors.js.map +0 -1
  197. package/dist/matter/clusters.d.ts.map +0 -1
  198. package/dist/matter/clusters.js.map +0 -1
  199. package/dist/matter/devices.d.ts.map +0 -1
  200. package/dist/matter/devices.js.map +0 -1
  201. package/dist/matter/endpoints.d.ts.map +0 -1
  202. package/dist/matter/endpoints.js.map +0 -1
  203. package/dist/matter/export.d.ts.map +0 -1
  204. package/dist/matter/export.js.map +0 -1
  205. package/dist/matter/types.d.ts.map +0 -1
  206. package/dist/matter/types.js.map +0 -1
  207. package/dist/matterNode.d.ts.map +0 -1
  208. package/dist/matterNode.js.map +0 -1
  209. package/dist/matterbridge.d.ts.map +0 -1
  210. package/dist/matterbridge.js.map +0 -1
  211. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  212. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  213. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  214. package/dist/matterbridgeBehaviors.js.map +0 -1
  215. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  216. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  217. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  218. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  219. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  220. package/dist/matterbridgeEndpoint.js.map +0 -1
  221. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  222. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  223. package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
  224. package/dist/matterbridgeEndpointTypes.js.map +0 -1
  225. package/dist/matterbridgePlatform.d.ts.map +0 -1
  226. package/dist/matterbridgePlatform.js.map +0 -1
  227. package/dist/mb_coap.d.ts.map +0 -1
  228. package/dist/mb_coap.js.map +0 -1
  229. package/dist/mb_health.d.ts.map +0 -1
  230. package/dist/mb_health.js.map +0 -1
  231. package/dist/mb_mdns.d.ts.map +0 -1
  232. package/dist/mb_mdns.js.map +0 -1
  233. package/dist/pluginManager.d.ts.map +0 -1
  234. package/dist/pluginManager.js.map +0 -1
  235. package/dist/spawn.d.ts.map +0 -1
  236. package/dist/spawn.js.map +0 -1
  237. package/dist/utils/export.d.ts.map +0 -1
  238. package/dist/utils/export.js.map +0 -1
  239. package/dist/workers/brand.d.ts +0 -25
  240. package/dist/workers/brand.d.ts.map +0 -1
  241. package/dist/workers/brand.extend.d.ts +0 -10
  242. package/dist/workers/brand.extend.d.ts.map +0 -1
  243. package/dist/workers/brand.extend.js +0 -15
  244. package/dist/workers/brand.extend.js.map +0 -1
  245. package/dist/workers/brand.invalid.d.ts +0 -9
  246. package/dist/workers/brand.invalid.d.ts.map +0 -1
  247. package/dist/workers/brand.invalid.js +0 -19
  248. package/dist/workers/brand.invalid.js.map +0 -1
  249. package/dist/workers/brand.js +0 -67
  250. package/dist/workers/brand.js.map +0 -1
  251. package/dist/workers/clusterTypes.d.ts +0 -47
  252. package/dist/workers/clusterTypes.d.ts.map +0 -1
  253. package/dist/workers/clusterTypes.js +0 -57
  254. package/dist/workers/clusterTypes.js.map +0 -1
  255. package/dist/workers/frontendWorker.d.ts +0 -2
  256. package/dist/workers/frontendWorker.d.ts.map +0 -1
  257. package/dist/workers/frontendWorker.js +0 -90
  258. package/dist/workers/frontendWorker.js.map +0 -1
  259. package/dist/workers/helloWorld.d.ts +0 -2
  260. package/dist/workers/helloWorld.d.ts.map +0 -1
  261. package/dist/workers/helloWorld.js +0 -135
  262. package/dist/workers/helloWorld.js.map +0 -1
  263. package/dist/workers/matterWorker.d.ts +0 -2
  264. package/dist/workers/matterWorker.d.ts.map +0 -1
  265. package/dist/workers/matterWorker.js +0 -104
  266. package/dist/workers/matterWorker.js.map +0 -1
  267. package/dist/workers/matterbridgeWorker.d.ts +0 -2
  268. package/dist/workers/matterbridgeWorker.d.ts.map +0 -1
  269. package/dist/workers/matterbridgeWorker.js +0 -75
  270. package/dist/workers/matterbridgeWorker.js.map +0 -1
  271. package/dist/workers/messageLab.d.ts +0 -134
  272. package/dist/workers/messageLab.d.ts.map +0 -1
  273. package/dist/workers/messageLab.js +0 -129
  274. package/dist/workers/messageLab.js.map +0 -1
  275. package/dist/workers/testWorker.d.ts +0 -2
  276. package/dist/workers/testWorker.d.ts.map +0 -1
  277. package/dist/workers/testWorker.js +0 -45
  278. package/dist/workers/testWorker.js.map +0 -1
  279. package/dist/workers/usage.d.ts +0 -19
  280. package/dist/workers/usage.d.ts.map +0 -1
  281. package/dist/workers/usage.js +0 -140
  282. package/dist/workers/usage.js.map +0 -1
  283. package/dist/workers/workerManager.d.ts +0 -115
  284. package/dist/workers/workerManager.d.ts.map +0 -1
  285. package/dist/workers/workerManager.js +0 -464
  286. package/dist/workers/workerManager.js.map +0 -1
  287. package/dist/workers/workerServer.d.ts +0 -126
  288. package/dist/workers/workerServer.d.ts.map +0 -1
  289. package/dist/workers/workerServer.js +0 -340
  290. package/dist/workers/workerServer.js.map +0 -1
  291. package/dist/workers/workerTypes.d.ts +0 -23
  292. package/dist/workers/workerTypes.d.ts.map +0 -1
  293. package/dist/workers/workerTypes.js +0 -3
  294. 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; // Skip querying if --coap-request is not specified
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; // Skip querying if --coap-request is not specified
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); // 10 minutes timeout to exit if no activity
50
+ }, 600000);
88
51
  }
89
- //# sourceMappingURL=mb_coap.js.map
@@ -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); // Send goodbye with TTL 0
67
+ advertise(mdnsIpv4, 0);
100
68
  if (mdnsIpv6)
101
- advertise(mdnsIpv6, 0); // Send goodbye with TTL 0
69
+ advertise(mdnsIpv6, 0);
102
70
  }
103
- await new Promise((resolve) => setTimeout(resolve, 250)); // Wait for 250ms to allow goodbye messages to be sent
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)); // Wait for 250ms to allow sockets to close
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 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
115
- { name: '_matter._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
116
- { name: '_matterbridge._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
117
- { name: '_home-assistant._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
118
- { name: '_shelly._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
119
- { name: '_mqtt._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
120
- { name: '_http._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
121
- { name: '_googlecast._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
122
- { name: '_airplay._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
123
- { name: '_amzn-alexa._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
124
- { name: '_companion-link._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
125
- { name: '_hap._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
126
- { name: '_hap._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
127
- { name: '_ipp._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
128
- { name: '_ipps._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
129
- { name: '_meshcop._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
130
- { name: '_printer._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
131
- { name: '_raop._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
132
- { name: '_sleep-proxy._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
133
- { name: '_ssh._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
134
- { name: '_services._dns-sd._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
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
- // PTR records for service types and instances
163
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpServiceTypeRdata },
164
- { name: httpServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpInstanceRdata },
165
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
166
- { name: matterbridgeServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeInstanceRdata },
167
- // SRV record for the HTTP instance
168
- { name: httpInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
169
- // SRV record for the matterbridge instance
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 /* DnsRecordType.A */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: mdns.encodeA(ipv4) });
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 /* DnsRecordType.AAAA */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: mdns.encodeAAAA(ipv6) });
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(); // 10 minutes timeout to exit if no activity
225
+ }, 600000).unref();
283
226
  }
284
227
  }
285
- //# sourceMappingURL=mb_mdns.js.map