matterbridge 3.5.0 → 3.5.1-dev-20260122-6461be3

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 (330) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README-DOCKER.md +4 -2
  3. package/README.md +4 -1
  4. package/bin/mb_coap.js +1 -1
  5. package/bin/mb_mdns.js +1 -1
  6. package/dist/broadcastServer.d.ts +0 -115
  7. package/dist/broadcastServer.js +1 -119
  8. package/dist/broadcastServerTypes.d.ts +0 -43
  9. package/dist/broadcastServerTypes.js +0 -24
  10. package/dist/cli.d.ts +1 -26
  11. package/dist/cli.js +2 -102
  12. package/dist/cliEmitter.d.ts +0 -36
  13. package/dist/cliEmitter.js +0 -37
  14. package/dist/cliHistory.d.ts +0 -42
  15. package/dist/cliHistory.js +1 -39
  16. package/dist/clusters/export.d.ts +0 -1
  17. package/dist/clusters/export.js +0 -2
  18. package/dist/deviceManager.d.ts +0 -108
  19. package/dist/deviceManager.js +2 -114
  20. package/dist/devices/airConditioner.d.ts +0 -75
  21. package/dist/devices/airConditioner.js +0 -57
  22. package/dist/devices/batteryStorage.d.ts +0 -43
  23. package/dist/devices/batteryStorage.js +1 -48
  24. package/dist/devices/cooktop.d.ts +0 -55
  25. package/dist/devices/cooktop.js +0 -56
  26. package/dist/devices/dishwasher.d.ts +0 -55
  27. package/dist/devices/dishwasher.js +0 -57
  28. package/dist/devices/evse.d.ts +0 -57
  29. package/dist/devices/evse.js +10 -74
  30. package/dist/devices/export.d.ts +0 -1
  31. package/dist/devices/export.js +0 -5
  32. package/dist/devices/extractorHood.d.ts +0 -41
  33. package/dist/devices/extractorHood.js +0 -43
  34. package/dist/devices/heatPump.d.ts +0 -43
  35. package/dist/devices/heatPump.js +2 -50
  36. package/dist/devices/laundryDryer.d.ts +0 -58
  37. package/dist/devices/laundryDryer.js +3 -62
  38. package/dist/devices/laundryWasher.d.ts +0 -64
  39. package/dist/devices/laundryWasher.js +4 -70
  40. package/dist/devices/microwaveOven.d.ts +1 -77
  41. package/dist/devices/microwaveOven.js +5 -88
  42. package/dist/devices/oven.d.ts +0 -82
  43. package/dist/devices/oven.js +0 -85
  44. package/dist/devices/refrigerator.d.ts +0 -100
  45. package/dist/devices/refrigerator.js +0 -102
  46. package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
  47. package/dist/devices/roboticVacuumCleaner.js +9 -100
  48. package/dist/devices/solarPower.d.ts +0 -36
  49. package/dist/devices/solarPower.js +0 -38
  50. package/dist/devices/speaker.d.ts +0 -79
  51. package/dist/devices/speaker.js +0 -84
  52. package/dist/devices/temperatureControl.d.ts +0 -21
  53. package/dist/devices/temperatureControl.js +3 -24
  54. package/dist/devices/waterHeater.d.ts +0 -74
  55. package/dist/devices/waterHeater.js +2 -82
  56. package/dist/frontend.d.ts +4 -187
  57. package/dist/frontend.js +89 -505
  58. package/dist/frontendTypes.d.ts +0 -57
  59. package/dist/frontendTypes.js +0 -45
  60. package/dist/helpers.d.ts +0 -43
  61. package/dist/helpers.js +1 -54
  62. package/dist/index.d.ts +0 -23
  63. package/dist/index.js +0 -25
  64. package/dist/jestutils/export.d.ts +0 -1
  65. package/dist/jestutils/export.js +0 -1
  66. package/dist/jestutils/jestHelpers.d.ts +0 -255
  67. package/dist/jestutils/jestHelpers.js +16 -379
  68. package/dist/logger/export.d.ts +0 -1
  69. package/dist/logger/export.js +0 -1
  70. package/dist/matter/behaviors.d.ts +0 -1
  71. package/dist/matter/behaviors.js +0 -2
  72. package/dist/matter/clusters.d.ts +0 -1
  73. package/dist/matter/clusters.js +0 -2
  74. package/dist/matter/devices.d.ts +0 -1
  75. package/dist/matter/devices.js +0 -2
  76. package/dist/matter/endpoints.d.ts +0 -1
  77. package/dist/matter/endpoints.js +0 -2
  78. package/dist/matter/export.d.ts +0 -1
  79. package/dist/matter/export.js +0 -2
  80. package/dist/matter/types.d.ts +0 -1
  81. package/dist/matter/types.js +0 -2
  82. package/dist/matterNode.d.ts +0 -258
  83. package/dist/matterNode.js +9 -364
  84. package/dist/matterbridge.d.ts +0 -362
  85. package/dist/matterbridge.js +75 -864
  86. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -36
  87. package/dist/matterbridgeAccessoryPlatform.js +0 -38
  88. package/dist/matterbridgeBehaviors.d.ts +0 -24
  89. package/dist/matterbridgeBehaviors.js +5 -68
  90. package/dist/matterbridgeDeviceTypes.d.ts +0 -649
  91. package/dist/matterbridgeDeviceTypes.js +6 -673
  92. package/dist/matterbridgeDynamicPlatform.d.ts +0 -36
  93. package/dist/matterbridgeDynamicPlatform.js +0 -38
  94. package/dist/matterbridgeEndpoint.d.ts +2 -1332
  95. package/dist/matterbridgeEndpoint.js +94 -1459
  96. package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
  97. package/dist/matterbridgeEndpointHelpers.js +22 -487
  98. package/dist/matterbridgeEndpointTypes.d.ts +0 -70
  99. package/dist/matterbridgeEndpointTypes.js +0 -25
  100. package/dist/matterbridgePlatform.d.ts +0 -425
  101. package/dist/matterbridgePlatform.js +2 -453
  102. package/dist/matterbridgeTypes.d.ts +0 -46
  103. package/dist/matterbridgeTypes.js +0 -26
  104. package/dist/mb_coap.d.ts +1 -0
  105. package/dist/{dgram/mb_coap.js → mb_coap.js} +3 -41
  106. package/dist/mb_mdns.d.ts +1 -0
  107. package/dist/{dgram/mb_mdns.js → mb_mdns.js} +47 -81
  108. package/dist/pluginManager.d.ts +0 -305
  109. package/dist/pluginManager.js +8 -345
  110. package/dist/shelly.d.ts +0 -157
  111. package/dist/shelly.js +7 -178
  112. package/dist/spawn.d.ts +1 -0
  113. package/dist/{utils/spawn.js → spawn.js} +3 -73
  114. package/dist/storage/export.d.ts +0 -1
  115. package/dist/storage/export.js +0 -1
  116. package/dist/update.d.ts +0 -75
  117. package/dist/update.js +7 -100
  118. package/dist/utils/export.d.ts +1 -13
  119. package/dist/utils/export.js +1 -13
  120. package/dist/workerGlobalPrefix.d.ts +0 -24
  121. package/dist/workerGlobalPrefix.js +6 -40
  122. package/dist/workerTypes.d.ts +0 -25
  123. package/dist/workerTypes.js +0 -24
  124. package/dist/workers.d.ts +0 -61
  125. package/dist/workers.js +4 -68
  126. package/npm-shrinkwrap.json +80 -50
  127. package/package.json +8 -8
  128. package/dist/broadcastServer.d.ts.map +0 -1
  129. package/dist/broadcastServer.js.map +0 -1
  130. package/dist/broadcastServerTypes.d.ts.map +0 -1
  131. package/dist/broadcastServerTypes.js.map +0 -1
  132. package/dist/cli.d.ts.map +0 -1
  133. package/dist/cli.js.map +0 -1
  134. package/dist/cliEmitter.d.ts.map +0 -1
  135. package/dist/cliEmitter.js.map +0 -1
  136. package/dist/cliHistory.d.ts.map +0 -1
  137. package/dist/cliHistory.js.map +0 -1
  138. package/dist/clusters/export.d.ts.map +0 -1
  139. package/dist/clusters/export.js.map +0 -1
  140. package/dist/deviceManager.d.ts.map +0 -1
  141. package/dist/deviceManager.js.map +0 -1
  142. package/dist/devices/airConditioner.d.ts.map +0 -1
  143. package/dist/devices/airConditioner.js.map +0 -1
  144. package/dist/devices/batteryStorage.d.ts.map +0 -1
  145. package/dist/devices/batteryStorage.js.map +0 -1
  146. package/dist/devices/cooktop.d.ts.map +0 -1
  147. package/dist/devices/cooktop.js.map +0 -1
  148. package/dist/devices/dishwasher.d.ts.map +0 -1
  149. package/dist/devices/dishwasher.js.map +0 -1
  150. package/dist/devices/evse.d.ts.map +0 -1
  151. package/dist/devices/evse.js.map +0 -1
  152. package/dist/devices/export.d.ts.map +0 -1
  153. package/dist/devices/export.js.map +0 -1
  154. package/dist/devices/extractorHood.d.ts.map +0 -1
  155. package/dist/devices/extractorHood.js.map +0 -1
  156. package/dist/devices/heatPump.d.ts.map +0 -1
  157. package/dist/devices/heatPump.js.map +0 -1
  158. package/dist/devices/laundryDryer.d.ts.map +0 -1
  159. package/dist/devices/laundryDryer.js.map +0 -1
  160. package/dist/devices/laundryWasher.d.ts.map +0 -1
  161. package/dist/devices/laundryWasher.js.map +0 -1
  162. package/dist/devices/microwaveOven.d.ts.map +0 -1
  163. package/dist/devices/microwaveOven.js.map +0 -1
  164. package/dist/devices/oven.d.ts.map +0 -1
  165. package/dist/devices/oven.js.map +0 -1
  166. package/dist/devices/refrigerator.d.ts.map +0 -1
  167. package/dist/devices/refrigerator.js.map +0 -1
  168. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  169. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  170. package/dist/devices/solarPower.d.ts.map +0 -1
  171. package/dist/devices/solarPower.js.map +0 -1
  172. package/dist/devices/speaker.d.ts.map +0 -1
  173. package/dist/devices/speaker.js.map +0 -1
  174. package/dist/devices/temperatureControl.d.ts.map +0 -1
  175. package/dist/devices/temperatureControl.js.map +0 -1
  176. package/dist/devices/waterHeater.d.ts.map +0 -1
  177. package/dist/devices/waterHeater.js.map +0 -1
  178. package/dist/dgram/coap.d.ts +0 -205
  179. package/dist/dgram/coap.d.ts.map +0 -1
  180. package/dist/dgram/coap.js +0 -365
  181. package/dist/dgram/coap.js.map +0 -1
  182. package/dist/dgram/dgram.d.ts +0 -144
  183. package/dist/dgram/dgram.d.ts.map +0 -1
  184. package/dist/dgram/dgram.js +0 -363
  185. package/dist/dgram/dgram.js.map +0 -1
  186. package/dist/dgram/mb_coap.d.ts +0 -24
  187. package/dist/dgram/mb_coap.d.ts.map +0 -1
  188. package/dist/dgram/mb_coap.js.map +0 -1
  189. package/dist/dgram/mb_mdns.d.ts +0 -24
  190. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  191. package/dist/dgram/mb_mdns.js.map +0 -1
  192. package/dist/dgram/mdns.d.ts +0 -371
  193. package/dist/dgram/mdns.d.ts.map +0 -1
  194. package/dist/dgram/mdns.js +0 -934
  195. package/dist/dgram/mdns.js.map +0 -1
  196. package/dist/dgram/multicast.d.ts +0 -67
  197. package/dist/dgram/multicast.d.ts.map +0 -1
  198. package/dist/dgram/multicast.js +0 -179
  199. package/dist/dgram/multicast.js.map +0 -1
  200. package/dist/dgram/unicast.d.ts +0 -64
  201. package/dist/dgram/unicast.d.ts.map +0 -1
  202. package/dist/dgram/unicast.js +0 -100
  203. package/dist/dgram/unicast.js.map +0 -1
  204. package/dist/frontend.d.ts.map +0 -1
  205. package/dist/frontend.js.map +0 -1
  206. package/dist/frontendTypes.d.ts.map +0 -1
  207. package/dist/frontendTypes.js.map +0 -1
  208. package/dist/helpers.d.ts.map +0 -1
  209. package/dist/helpers.js.map +0 -1
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js.map +0 -1
  212. package/dist/jestutils/export.d.ts.map +0 -1
  213. package/dist/jestutils/export.js.map +0 -1
  214. package/dist/jestutils/jestHelpers.d.ts.map +0 -1
  215. package/dist/jestutils/jestHelpers.js.map +0 -1
  216. package/dist/logger/export.d.ts.map +0 -1
  217. package/dist/logger/export.js.map +0 -1
  218. package/dist/matter/behaviors.d.ts.map +0 -1
  219. package/dist/matter/behaviors.js.map +0 -1
  220. package/dist/matter/clusters.d.ts.map +0 -1
  221. package/dist/matter/clusters.js.map +0 -1
  222. package/dist/matter/devices.d.ts.map +0 -1
  223. package/dist/matter/devices.js.map +0 -1
  224. package/dist/matter/endpoints.d.ts.map +0 -1
  225. package/dist/matter/endpoints.js.map +0 -1
  226. package/dist/matter/export.d.ts.map +0 -1
  227. package/dist/matter/export.js.map +0 -1
  228. package/dist/matter/types.d.ts.map +0 -1
  229. package/dist/matter/types.js.map +0 -1
  230. package/dist/matterNode.d.ts.map +0 -1
  231. package/dist/matterNode.js.map +0 -1
  232. package/dist/matterbridge.d.ts.map +0 -1
  233. package/dist/matterbridge.js.map +0 -1
  234. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  235. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  236. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  237. package/dist/matterbridgeBehaviors.js.map +0 -1
  238. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  239. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  240. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  241. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  242. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  243. package/dist/matterbridgeEndpoint.js.map +0 -1
  244. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  245. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  246. package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
  247. package/dist/matterbridgeEndpointTypes.js.map +0 -1
  248. package/dist/matterbridgePlatform.d.ts.map +0 -1
  249. package/dist/matterbridgePlatform.js.map +0 -1
  250. package/dist/matterbridgeTypes.d.ts.map +0 -1
  251. package/dist/matterbridgeTypes.js.map +0 -1
  252. package/dist/pluginManager.d.ts.map +0 -1
  253. package/dist/pluginManager.js.map +0 -1
  254. package/dist/shelly.d.ts.map +0 -1
  255. package/dist/shelly.js.map +0 -1
  256. package/dist/storage/export.d.ts.map +0 -1
  257. package/dist/storage/export.js.map +0 -1
  258. package/dist/update.d.ts.map +0 -1
  259. package/dist/update.js.map +0 -1
  260. package/dist/utils/colorUtils.d.ts +0 -101
  261. package/dist/utils/colorUtils.d.ts.map +0 -1
  262. package/dist/utils/colorUtils.js +0 -282
  263. package/dist/utils/colorUtils.js.map +0 -1
  264. package/dist/utils/commandLine.d.ts +0 -66
  265. package/dist/utils/commandLine.d.ts.map +0 -1
  266. package/dist/utils/commandLine.js +0 -123
  267. package/dist/utils/commandLine.js.map +0 -1
  268. package/dist/utils/copyDirectory.d.ts +0 -35
  269. package/dist/utils/copyDirectory.d.ts.map +0 -1
  270. package/dist/utils/copyDirectory.js +0 -76
  271. package/dist/utils/copyDirectory.js.map +0 -1
  272. package/dist/utils/createDirectory.d.ts +0 -34
  273. package/dist/utils/createDirectory.d.ts.map +0 -1
  274. package/dist/utils/createDirectory.js +0 -54
  275. package/dist/utils/createDirectory.js.map +0 -1
  276. package/dist/utils/createZip.d.ts +0 -39
  277. package/dist/utils/createZip.d.ts.map +0 -1
  278. package/dist/utils/createZip.js +0 -114
  279. package/dist/utils/createZip.js.map +0 -1
  280. package/dist/utils/deepCopy.d.ts +0 -32
  281. package/dist/utils/deepCopy.d.ts.map +0 -1
  282. package/dist/utils/deepCopy.js +0 -79
  283. package/dist/utils/deepCopy.js.map +0 -1
  284. package/dist/utils/deepEqual.d.ts +0 -54
  285. package/dist/utils/deepEqual.d.ts.map +0 -1
  286. package/dist/utils/deepEqual.js +0 -129
  287. package/dist/utils/deepEqual.js.map +0 -1
  288. package/dist/utils/error.d.ts +0 -45
  289. package/dist/utils/error.d.ts.map +0 -1
  290. package/dist/utils/error.js +0 -54
  291. package/dist/utils/error.js.map +0 -1
  292. package/dist/utils/export.d.ts.map +0 -1
  293. package/dist/utils/export.js.map +0 -1
  294. package/dist/utils/format.d.ts +0 -53
  295. package/dist/utils/format.d.ts.map +0 -1
  296. package/dist/utils/format.js +0 -78
  297. package/dist/utils/format.js.map +0 -1
  298. package/dist/utils/hex.d.ts +0 -89
  299. package/dist/utils/hex.d.ts.map +0 -1
  300. package/dist/utils/hex.js +0 -242
  301. package/dist/utils/hex.js.map +0 -1
  302. package/dist/utils/inspector.d.ts +0 -87
  303. package/dist/utils/inspector.d.ts.map +0 -1
  304. package/dist/utils/inspector.js +0 -268
  305. package/dist/utils/inspector.js.map +0 -1
  306. package/dist/utils/isValid.d.ts +0 -103
  307. package/dist/utils/isValid.d.ts.map +0 -1
  308. package/dist/utils/isValid.js +0 -162
  309. package/dist/utils/isValid.js.map +0 -1
  310. package/dist/utils/network.d.ts +0 -141
  311. package/dist/utils/network.d.ts.map +0 -1
  312. package/dist/utils/network.js +0 -314
  313. package/dist/utils/network.js.map +0 -1
  314. package/dist/utils/spawn.d.ts +0 -33
  315. package/dist/utils/spawn.d.ts.map +0 -1
  316. package/dist/utils/spawn.js.map +0 -1
  317. package/dist/utils/tracker.d.ts +0 -108
  318. package/dist/utils/tracker.d.ts.map +0 -1
  319. package/dist/utils/tracker.js +0 -264
  320. package/dist/utils/tracker.js.map +0 -1
  321. package/dist/utils/wait.d.ts +0 -54
  322. package/dist/utils/wait.d.ts.map +0 -1
  323. package/dist/utils/wait.js +0 -125
  324. package/dist/utils/wait.js.map +0 -1
  325. package/dist/workerGlobalPrefix.d.ts.map +0 -1
  326. package/dist/workerGlobalPrefix.js.map +0 -1
  327. package/dist/workerTypes.d.ts.map +0 -1
  328. package/dist/workerTypes.js.map +0 -1
  329. package/dist/workers.d.ts.map +0 -1
  330. 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; // 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
@@ -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 ::).
@@ -45,6 +18,7 @@ Options:
45
18
  --advertise <interval> Enable matterbridge mDNS advertisement each ms (default interval: 10000ms).
46
19
  --query <interval> Enable common mDNS services query each ms (default interval: 10000ms).
47
20
  --filter <string...> Filter strings to match in the mDNS record name (default: no filter).
21
+ --ip-filter <string...> Filter strings to match in the mDNS sender ip address (default: no filter).
48
22
  --noIpv4 Disable IPv4 mDNS server (default: enabled).
49
23
  --noIpv6 Disable IPv6 mDNS server (default: enabled).
50
24
  --no-timeout Disable automatic timeout of 10 minutes. Reflector mode disables timeout automatically.
@@ -62,6 +36,9 @@ Examples:
62
36
  # Listen for Matter commissioner and discovery service records on all interfaces
63
37
  mb_mdns --filter _matterc._udp _matter._tcp
64
38
 
39
+ # Listen for Matter commissioner and discovery service records on all interfaces from specific ipv4 and ipv6 ips
40
+ mb_mdns --filter _matterc._udp _matter._tcp --ip-filter 192.168.69.20 fe80::1077:2e0d:2c91:aa90
41
+
65
42
  # Query for mDNS devices every 10s on a specific interface
66
43
  mb_mdns --interfaceName eth0 --query
67
44
 
@@ -71,20 +48,15 @@ Examples:
71
48
  # Query each 5s and listen for _matterbridge._tcp.local service records
72
49
  mb_mdns --query 5000 --filter _matterbridge._tcp.local
73
50
  `);
74
- // eslint-disable-next-line n/no-process-exit
75
51
  process.exit(0);
76
52
  }
77
- // Dynamic JSON import (Node >= 20) with import attributes
78
- const { default: pkg } = await import('../../package.json', { with: { type: 'json' } });
53
+ const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
79
54
  let mdnsIpv4QueryInterval;
80
55
  let mdnsIpv6QueryInterval;
81
56
  let mdnsIpv4AdvertiseInterval;
82
57
  let mdnsIpv6AdvertiseInterval;
83
58
  let mdnsIpv4 = undefined;
84
59
  let mdnsIpv6 = undefined;
85
- /**
86
- * Cleanup and log device information before exiting.
87
- */
88
60
  async function cleanupAndLogAndExit() {
89
61
  clearInterval(mdnsIpv4QueryInterval);
90
62
  clearInterval(mdnsIpv6QueryInterval);
@@ -92,42 +64,48 @@ Examples:
92
64
  clearInterval(mdnsIpv6AdvertiseInterval);
93
65
  if (hasParameter('advertise')) {
94
66
  if (mdnsIpv4)
95
- advertise(mdnsIpv4, 0); // Send goodbye with TTL 0
67
+ advertise(mdnsIpv4, 0);
96
68
  if (mdnsIpv6)
97
- advertise(mdnsIpv6, 0); // Send goodbye with TTL 0
69
+ advertise(mdnsIpv6, 0);
98
70
  }
99
- 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));
100
72
  mdnsIpv4?.stop();
101
73
  mdnsIpv6?.stop();
102
74
  mdnsIpv4?.logDevices();
103
75
  mdnsIpv6?.logDevices();
104
- await new Promise((resolve) => setTimeout(resolve, 250)); // Wait for 250ms to allow sockets to close
76
+ await new Promise((resolve) => setTimeout(resolve, 250));
105
77
  }
106
78
  const query = (mdns) => {
107
79
  mdns.log.info('Sending mDNS query for common services...');
108
80
  try {
109
81
  mdns.sendQuery([
110
- { name: '_matterc._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
111
- { name: '_matter._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
112
- { name: '_matterbridge._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
113
- { name: '_home-assistant._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
114
- { name: '_shelly._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
115
- { name: '_mqtt._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
116
- { name: '_http._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
117
- { name: '_googlecast._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
118
- { 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 },
119
103
  ]);
120
104
  }
121
105
  catch (error) {
122
106
  mdns.log.error(`Error sending mDNS query: ${error.message}`);
123
107
  }
124
108
  };
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
109
  const advertise = (mdns, ttl = 120) => {
132
110
  mdns.log.info(`Sending mDNS advertisement for matterbridge service with TTL ${ttl ? ttl.toString() : 'goodbye'}...`);
133
111
  const httpServiceType = '_http._tcp.local';
@@ -143,25 +121,17 @@ Examples:
143
121
  const srvRdata = mdns.encodeSrvRdata(0, 0, port, hostName);
144
122
  const txtRdata = mdns.encodeTxtRdata([`version=${pkg.version}`, 'path=/']);
145
123
  const answers = [
146
- // PTR records for service types and instances
147
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpServiceTypeRdata },
148
- { name: httpServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpInstanceRdata },
149
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
150
- { name: matterbridgeServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeInstanceRdata },
151
- // SRV record for the HTTP instance
152
- { name: httpInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
153
- // SRV record for the matterbridge instance
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 },
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 },
159
132
  ];
160
- // Always attempt to add both A and all AAAA records (best effort), regardless of the socket family.
161
133
  const interfaces = os.networkInterfaces();
162
- // Use specified interface name if provided
163
134
  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
135
  if (!interfaceInfos) {
166
136
  interfaceInfos = [];
167
137
  for (const name of Object.keys(interfaces)) {
@@ -172,15 +142,14 @@ Examples:
172
142
  }
173
143
  }
174
144
  }
175
- // Encode A and AAAA records for all non-internal addresses of the selected interface
176
145
  for (const info of interfaceInfos) {
177
146
  if (info.family === 'IPv4' && !info.internal) {
178
147
  const ipv4 = info.address;
179
- 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) });
180
149
  }
181
150
  else if (info.family === 'IPv6' && !info.internal) {
182
151
  const ipv6 = info.address;
183
- 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) });
184
153
  }
185
154
  }
186
155
  try {
@@ -194,15 +163,15 @@ Examples:
194
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'));
195
164
  if (hasParameter('v') || hasParameter('verbose'))
196
165
  mdnsIpv4.listNetworkInterfaces();
197
- // Apply filters if any
198
166
  const filters = getStringArrayParameter('filter');
199
167
  if (filters)
200
168
  mdnsIpv4.filters.push(...filters);
201
- // Handle errors
169
+ const ipFilters = getStringArrayParameter('ip-filter');
170
+ if (ipFilters)
171
+ mdnsIpv4.ipFilters.push(...ipFilters);
202
172
  mdnsIpv4.on('error', (err) => {
203
173
  mdnsIpv4?.log.error(`mDNS udp4 Server error: ${err.message}\n${err.stack}`);
204
174
  });
205
- // Start the IPv4 mDNS server
206
175
  mdnsIpv4.start();
207
176
  mdnsIpv4.on('ready', (address) => {
208
177
  mdnsIpv4?.socket.setMulticastLoopback(false);
@@ -221,15 +190,15 @@ Examples:
221
190
  mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
222
191
  if (hasParameter('v') || hasParameter('verbose'))
223
192
  mdnsIpv6.listNetworkInterfaces();
224
- // Apply filters if any
225
193
  const filters = getStringArrayParameter('filter');
226
194
  if (filters)
227
195
  mdnsIpv6.filters.push(...filters);
228
- // Handle errors
196
+ const ipFilters = getStringArrayParameter('ip-filter');
197
+ if (ipFilters)
198
+ mdnsIpv6.ipFilters.push(...ipFilters);
229
199
  mdnsIpv6.on('error', (err) => {
230
200
  mdnsIpv6?.log.error(`mDNS udp6 Server error: ${err.message}\n${err.stack}`);
231
201
  });
232
- // Start the IPv6 mDNS server
233
202
  mdnsIpv6.start();
234
203
  mdnsIpv6.on('ready', (address) => {
235
204
  mdnsIpv6?.socket.setMulticastLoopback(false);
@@ -244,18 +213,15 @@ Examples:
244
213
  }
245
214
  });
246
215
  }
247
- // Handle Ctrl+C (SIGINT) and SIGTERM to stop and log devices
248
216
  process.on('SIGINT', async () => {
249
217
  await cleanupAndLogAndExit();
250
218
  });
251
219
  process.on('SIGTERM', async () => {
252
220
  await cleanupAndLogAndExit();
253
221
  });
254
- // Exit after a timeout to avoid running indefinitely in test environments
255
222
  if (!hasParameter('no-timeout')) {
256
223
  setTimeout(async () => {
257
224
  await cleanupAndLogAndExit();
258
- }, 600000).unref(); // 10 minutes timeout to exit if no activity
225
+ }, 600000).unref();
259
226
  }
260
227
  }
261
- //# sourceMappingURL=mb_mdns.js.map