matterbridge 3.4.5-dev-20251225-2f72161 → 3.4.5-dev-20251225-742588e
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/dist/dgram/dgram.js +3 -2
- package/dist/dgram/mMdnsReflector.js +2 -0
- package/dist/dgram/mb_mdns.js +11 -7
- package/dist/dgram/unicast.js +4 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/dgram/dgram.js
CHANGED
|
@@ -17,6 +17,7 @@ export class Dgram extends EventEmitter {
|
|
|
17
17
|
this.socketType = socketType;
|
|
18
18
|
this.interfaceName = interfaceName;
|
|
19
19
|
this.interfaceAddress = interfaceAddress;
|
|
20
|
+
this.log.debug(`Created socket of type ${BLUE}${socketType}${db} on interface ${BLUE}${interfaceName || 'any'}${db} with address ${BLUE}${interfaceAddress || 'any'}${db} reuseAddr=${BLUE}${reuseAddr}${db}`);
|
|
20
21
|
this.socket.on('error', (error) => {
|
|
21
22
|
this.log.debug(`Socket error: ${error instanceof Error ? error.message : error}`);
|
|
22
23
|
this.emit('error', error);
|
|
@@ -199,14 +200,14 @@ export class Dgram extends EventEmitter {
|
|
|
199
200
|
return undefined;
|
|
200
201
|
}
|
|
201
202
|
getNetmask(interfaceAddress) {
|
|
202
|
-
const
|
|
203
|
+
const noZoneAddress = interfaceAddress.includes('%') ? interfaceAddress.split('%')[0] : interfaceAddress;
|
|
203
204
|
const nets = os.networkInterfaces();
|
|
204
205
|
for (const ifaceName in nets) {
|
|
205
206
|
const ifaceAddresses = nets[ifaceName];
|
|
206
207
|
if (!ifaceAddresses)
|
|
207
208
|
continue;
|
|
208
209
|
for (const addr of ifaceAddresses) {
|
|
209
|
-
if (addr.address ===
|
|
210
|
+
if (addr.address === noZoneAddress) {
|
|
210
211
|
return addr.netmask;
|
|
211
212
|
}
|
|
212
213
|
}
|
package/dist/dgram/mb_mdns.js
CHANGED
|
@@ -2,6 +2,7 @@ import { getIntParameter, getParameter, getStringArrayParameter, hasParameter }
|
|
|
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
4
|
import { Unicast } from './unicast.js';
|
|
5
|
+
import { MDNS_REFLECTOR_ADDRESS, MDNS_REFLECTOR_PORT } from './mMdnsReflector.js';
|
|
5
6
|
{
|
|
6
7
|
if (hasParameter('h') || hasParameter('help')) {
|
|
7
8
|
console.log(`Copyright (c) Matterbridge. All rights reserved.\n`);
|
|
@@ -53,7 +54,7 @@ Examples:
|
|
|
53
54
|
let mdnsIpv6AdvertiseInterval;
|
|
54
55
|
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'));
|
|
55
56
|
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',
|
|
57
|
+
const unicast = new Unicast('mDNS Unicast Server', 'udp4', false, undefined, MDNS_REFLECTOR_ADDRESS, MDNS_REFLECTOR_PORT);
|
|
57
58
|
if (hasParameter('v') || hasParameter('verbose')) {
|
|
58
59
|
mdnsIpv4.log.logLevel = "debug";
|
|
59
60
|
mdnsIpv6.log.logLevel = "debug";
|
|
@@ -165,7 +166,7 @@ Examples:
|
|
|
165
166
|
if (mdns.socketType === 'udp4' && hasParameter('localhost')) {
|
|
166
167
|
try {
|
|
167
168
|
mdns.log.info(`**Sending mDNS advertisement for matterbridge service to localhost...`);
|
|
168
|
-
mdns.socket.send(response, 0, response.length,
|
|
169
|
+
mdns.socket.send(response, 0, response.length, MDNS_REFLECTOR_PORT, MDNS_REFLECTOR_ADDRESS, (error) => {
|
|
169
170
|
if (error) {
|
|
170
171
|
mdns.log.error(`**Error sending mDNS advertisement to localhost: ${error.message}`);
|
|
171
172
|
}
|
|
@@ -216,7 +217,8 @@ Examples:
|
|
|
216
217
|
process.on('SIGINT', async () => {
|
|
217
218
|
await cleanupAndLogAndExit();
|
|
218
219
|
});
|
|
219
|
-
|
|
220
|
+
if (!hasParameter('noIpv4'))
|
|
221
|
+
mdnsIpv4.start();
|
|
220
222
|
mdnsIpv4.on('ready', (address) => {
|
|
221
223
|
mdnsIpv4.log.info(`mdnsIpv4 server ready on ${address.family} ${address.address}:${address.port}`);
|
|
222
224
|
if (hasParameter('advertise')) {
|
|
@@ -232,7 +234,8 @@ Examples:
|
|
|
232
234
|
}, getIntParameter('query') || 10000).unref();
|
|
233
235
|
}
|
|
234
236
|
});
|
|
235
|
-
|
|
237
|
+
if (!hasParameter('noIpv6'))
|
|
238
|
+
mdnsIpv6.start();
|
|
236
239
|
mdnsIpv6.on('ready', (address) => {
|
|
237
240
|
mdnsIpv6.log.info(`mdnsIpv6 server ready on ${address.family} ${address.address}:${address.port}`);
|
|
238
241
|
if (hasParameter('advertise')) {
|
|
@@ -248,9 +251,10 @@ Examples:
|
|
|
248
251
|
}, getIntParameter('query') || 10000).unref();
|
|
249
252
|
}
|
|
250
253
|
});
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
if (hasParameter('reflector'))
|
|
255
|
+
unicast.start();
|
|
256
|
+
unicast.on('bound', (address) => {
|
|
257
|
+
unicast.log.info(`**Bound on ${address.family} ${address.address}:${address.port}`);
|
|
254
258
|
});
|
|
255
259
|
unicast.on('message', (msg, rinfo) => {
|
|
256
260
|
unicast.log.info(`**Received message from ${rinfo.address}:${rinfo.port} - ${msg.length} bytes`);
|
package/dist/dgram/unicast.js
CHANGED
|
@@ -16,6 +16,7 @@ export class Unicast extends Dgram {
|
|
|
16
16
|
this.interfaceAddress = this.interfaceAddress ?? (this.interfaceName ? this.getIpv6InterfaceAddress(this.interfaceName) : undefined);
|
|
17
17
|
}
|
|
18
18
|
this.interfaceNetmask = this.interfaceAddress ? this.getNetmask(this.interfaceAddress) : undefined;
|
|
19
|
+
this.log.debug(`Binding dgram unicast socket to ${BLUE}${this.interfaceAddress || 'all available addresses'}${db} on port ${BLUE}${this.port || 'any available port'}${db}...`);
|
|
19
20
|
this.socket.bind(this.port, this.interfaceAddress, () => {
|
|
20
21
|
const address = this.socket.address();
|
|
21
22
|
this.log.debug(`Dgram unicast socket bound to ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
|
|
@@ -27,7 +28,9 @@ export class Unicast extends Dgram {
|
|
|
27
28
|
this.socket.setBroadcast(true);
|
|
28
29
|
this.log.debug(`Dgram unicast socket broadcast enabled`);
|
|
29
30
|
this.emit('ready', address);
|
|
30
|
-
|
|
31
|
+
}
|
|
32
|
+
onMessage(msg, rinfo) {
|
|
33
|
+
this.log.debug(`Socket received a message from ${BLUE}${rinfo.family}${db} ${BLUE}${rinfo.address}${db}:${BLUE}${rinfo.port}${db}`);
|
|
31
34
|
}
|
|
32
35
|
stop() {
|
|
33
36
|
this.log.debug('Stopping dgram unicast socket...');
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.4.5-dev-20251225-
|
|
3
|
+
"version": "3.4.5-dev-20251225-742588e",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.4.5-dev-20251225-
|
|
9
|
+
"version": "3.4.5-dev-20251225-742588e",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.6",
|
package/package.json
CHANGED