matterbridge 3.4.5-dev-20251224-fd9f02e → 3.4.5-dev-20251225-2f72161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/dist/dgram/mb_mdns.js +71 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -39,6 +39,9 @@ Advantages:
|
|
|
39
39
|
- [mdns]: Added TXT/SRV/A/AAAA encoders into the Mdns class.
|
|
40
40
|
- [mb_mdns]: Added broadcast parameter to allow advertising when multicast is not available.
|
|
41
41
|
- [mb_mdns]: Added \_matterbridge.\_tcp.local to query and advertise.
|
|
42
|
+
- [mb_mdns]: Added localhost parameter to send unicast messages to localhost.
|
|
43
|
+
- [mb_mdns]: Added unicastIpv4 parameter to send unicast messages.
|
|
44
|
+
- [mb_mdns]: Added unicastIpv6 parameter to send unicast messages.
|
|
42
45
|
|
|
43
46
|
### Changed
|
|
44
47
|
|
package/dist/dgram/mb_mdns.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getIntParameter, getParameter, getStringArrayParameter, hasParameter } from '../utils/commandLine.js';
|
|
2
2
|
import { MDNS_MULTICAST_IPV4_ADDRESS, MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT } from './multicast.js';
|
|
3
3
|
import { Mdns } from './mdns.js';
|
|
4
|
+
import { Unicast } from './unicast.js';
|
|
4
5
|
{
|
|
5
6
|
if (hasParameter('h') || hasParameter('help')) {
|
|
6
7
|
console.log(`Copyright (c) Matterbridge. All rights reserved.\n`);
|
|
@@ -15,6 +16,10 @@ Options:
|
|
|
15
16
|
--ipv6InterfaceAddress <address> IPv6 address of the network interface to bind to (default: ::).
|
|
16
17
|
--outgoingIpv4InterfaceAddress <address> Outgoing IPv4 address of the network interface (default first external address).
|
|
17
18
|
--outgoingIpv6InterfaceAddress <address> Outgoing IPv6 address of the network interface (default first external address).
|
|
19
|
+
--unicastIpv4 <address> Unicast IPv4 address to send mDNS advertisements to (default: disabled).
|
|
20
|
+
--unicastIpv6 <address> Unicast IPv6 address to send mDNS advertisements to (default: disabled).
|
|
21
|
+
--broadcast Enable broadcasting of mDNS advertisements (default: disabled).
|
|
22
|
+
--localhost Enable sending mDNS advertisements to localhost (default: disabled).
|
|
18
23
|
--advertise <interval> Enable matterbridge mDNS advertisement each ms (default interval: 10000ms).
|
|
19
24
|
--query <interval> Enable common mDNS services query each ms (default interval: 10000ms).
|
|
20
25
|
--filter <string...> Filter strings to match in the mDNS record name (default: no filter).
|
|
@@ -48,13 +53,16 @@ Examples:
|
|
|
48
53
|
let mdnsIpv6AdvertiseInterval;
|
|
49
54
|
const 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'));
|
|
50
55
|
const mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
|
|
56
|
+
const unicast = new Unicast('mDNS Unicast Server', 'udp4', true, undefined, 'localhost', MDNS_MULTICAST_PORT);
|
|
51
57
|
if (hasParameter('v') || hasParameter('verbose')) {
|
|
52
58
|
mdnsIpv4.log.logLevel = "debug";
|
|
53
59
|
mdnsIpv6.log.logLevel = "debug";
|
|
60
|
+
unicast.log.logLevel = "debug";
|
|
54
61
|
}
|
|
55
62
|
else {
|
|
56
63
|
mdnsIpv4.log.logLevel = "info";
|
|
57
64
|
mdnsIpv6.log.logLevel = "info";
|
|
65
|
+
unicast.log.logLevel = "info";
|
|
58
66
|
}
|
|
59
67
|
mdnsIpv4.listNetworkInterfaces();
|
|
60
68
|
const filters = getStringArrayParameter('filter');
|
|
@@ -74,6 +82,7 @@ Examples:
|
|
|
74
82
|
clearInterval(mdnsIpv6AdvertiseInterval);
|
|
75
83
|
mdnsIpv4.stop();
|
|
76
84
|
mdnsIpv6.stop();
|
|
85
|
+
unicast.stop();
|
|
77
86
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
78
87
|
mdnsIpv4.logDevices();
|
|
79
88
|
mdnsIpv6.logDevices();
|
|
@@ -86,6 +95,7 @@ Examples:
|
|
|
86
95
|
{ name: '_matter._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
87
96
|
{ name: '_matterbridge._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
88
97
|
{ name: '_shelly._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
98
|
+
{ name: '_mqtt._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
89
99
|
{ name: '_http._tcp.local', type: 12, class: 1, unicastResponse: true },
|
|
90
100
|
{ name: '_services._dns-sd._udp.local', type: 12, class: 1, unicastResponse: true },
|
|
91
101
|
]);
|
|
@@ -138,13 +148,13 @@ Examples:
|
|
|
138
148
|
const address = mdns.socketType === 'udp4' ? mdns.getIpv4InterfaceAddress(mdns.interfaceName) : mdns.getIpv6InterfaceAddress(mdns.interfaceName);
|
|
139
149
|
const mask = mdns.socketType === 'udp4' ? mdns.getNetmask(address) : undefined;
|
|
140
150
|
const broadcastAddress = mdns.socketType === 'udp4' ? mdns.getIpv4BroadcastAddress(address, mask) : mdns.getIpv6BroadcastAddress();
|
|
141
|
-
mdns.log.info(
|
|
142
|
-
mdns.socket.send(response, 0, response.length,
|
|
151
|
+
mdns.log.info(`***Broadcasting mDNS advertisement for matterbridge service to ${broadcastAddress}...`);
|
|
152
|
+
mdns.socket.send(response, 0, response.length, MDNS_MULTICAST_PORT, broadcastAddress, (error) => {
|
|
143
153
|
if (error) {
|
|
144
|
-
mdns.log.error(`Error broadcasting mDNS advertisement: ${error.message}`);
|
|
154
|
+
mdns.log.error(`Error broadcasting mDNS advertisement to ${broadcastAddress}: ${error.message}`);
|
|
145
155
|
}
|
|
146
156
|
else {
|
|
147
|
-
mdns.log.info(
|
|
157
|
+
mdns.log.info(`**mDNS advertisement broadcasted successfully to ${broadcastAddress}`);
|
|
148
158
|
}
|
|
149
159
|
});
|
|
150
160
|
}
|
|
@@ -152,6 +162,56 @@ Examples:
|
|
|
152
162
|
mdns.log.error(`Error broadcasting mDNS advertisement: ${error.message}`);
|
|
153
163
|
}
|
|
154
164
|
}
|
|
165
|
+
if (mdns.socketType === 'udp4' && hasParameter('localhost')) {
|
|
166
|
+
try {
|
|
167
|
+
mdns.log.info(`**Sending mDNS advertisement for matterbridge service to localhost...`);
|
|
168
|
+
mdns.socket.send(response, 0, response.length, MDNS_MULTICAST_PORT, 'localhost', (error) => {
|
|
169
|
+
if (error) {
|
|
170
|
+
mdns.log.error(`**Error sending mDNS advertisement to localhost: ${error.message}`);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
mdns.log.info(`**mDNS advertisement sent successfully to localhost`);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
mdns.log.error(`**Error sending mDNS advertisement to localhost: ${error.message}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (mdns.socketType === 'udp4' && getParameter('unicastIpv4')) {
|
|
182
|
+
const unicastAddress = getParameter('unicastIpv4');
|
|
183
|
+
try {
|
|
184
|
+
mdns.log.info(`**Sending mDNS advertisement for matterbridge service to unicast ${unicastAddress}...`);
|
|
185
|
+
mdns.socket.send(response, 0, response.length, MDNS_MULTICAST_PORT, unicastAddress, (error) => {
|
|
186
|
+
if (error) {
|
|
187
|
+
mdns.log.error(`Error sending mDNS advertisement to unicast ${unicastAddress}: ${error.message}`);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
mdns.log.info(`**mDNS advertisement sent successfully to unicast ${unicastAddress}`);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
mdns.log.error(`Error sending mDNS advertisement to unicast ${unicastAddress}: ${error.message}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (mdns.socketType === 'udp6' && getParameter('unicastIpv6')) {
|
|
199
|
+
const unicastAddress = getParameter('unicastIpv6');
|
|
200
|
+
try {
|
|
201
|
+
mdns.log.info(`**Sending mDNS advertisement for matterbridge service to unicast ${unicastAddress}...`);
|
|
202
|
+
mdns.socket.send(response, 0, response.length, MDNS_MULTICAST_PORT, unicastAddress, (error) => {
|
|
203
|
+
if (error) {
|
|
204
|
+
mdns.log.error(`Error sending mDNS advertisement to unicast ${unicastAddress}: ${error.message}`);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
mdns.log.info(`**mDNS advertisement sent successfully to unicast ${unicastAddress}`);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
mdns.log.error(`Error sending mDNS advertisement to unicast ${unicastAddress}: ${error.message}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
155
215
|
};
|
|
156
216
|
process.on('SIGINT', async () => {
|
|
157
217
|
await cleanupAndLogAndExit();
|
|
@@ -188,6 +248,13 @@ Examples:
|
|
|
188
248
|
}, getIntParameter('query') || 10000).unref();
|
|
189
249
|
}
|
|
190
250
|
});
|
|
251
|
+
unicast.start();
|
|
252
|
+
unicast.on('ready', (address) => {
|
|
253
|
+
unicast.log.info(`**Ready on ${address.family} ${address.address}:${address.port}`);
|
|
254
|
+
});
|
|
255
|
+
unicast.on('message', (msg, rinfo) => {
|
|
256
|
+
unicast.log.info(`**Received message from ${rinfo.address}:${rinfo.port} - ${msg.length} bytes`);
|
|
257
|
+
});
|
|
191
258
|
setTimeout(async () => {
|
|
192
259
|
await cleanupAndLogAndExit();
|
|
193
260
|
}, 600000).unref();
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.4.5-dev-
|
|
3
|
+
"version": "3.4.5-dev-20251225-2f72161",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.4.5-dev-
|
|
9
|
+
"version": "3.4.5-dev-20251225-2f72161",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.6",
|
package/package.json
CHANGED