matterbridge 3.4.5-dev-20251224-457def5 → 3.4.5-dev-20251224-fd9f02e

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 CHANGED
@@ -38,6 +38,7 @@ Advantages:
38
38
  - [mb_mdns]: Advertise full DNS-SD record set (PTR/SRV/TXT/A/AAAA) for matterbridge.\_http.\_tcp.local on port 8283.
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
+ - [mb_mdns]: Added \_matterbridge.\_tcp.local to query and advertise.
41
42
 
42
43
  ### Changed
43
44
 
@@ -33,16 +33,19 @@ Examples:
33
33
  # Query for mDNS devices every 10s on a specific interface
34
34
  mb_mdns --interfaceName eth0 --query
35
35
 
36
- # Advertise matterbridge._http._tcp.local every 5s with filter
37
- mb_mdns --advertise 5000 --filter matterbridge._http._tcp.local
38
-
39
- # Query each 5s and listen for matterbridge._http._tcp.local service records
40
- mb_mdns --query 5000 --filter matterbridge._http._tcp.local
36
+ # Advertise _matterbridge._tcp.local every 5s with filter
37
+ mb_mdns --advertise 5000 --filter _matterbridge._tcp.local
41
38
 
39
+ # Query each 5s and listen for _matterbridge._tcp.local service records
40
+ mb_mdns --query 5000 --filter _matterbridge._tcp.local
42
41
  `);
43
42
  process.exit(0);
44
43
  }
45
44
  const { default: pkg } = await import('../../package.json', { with: { type: 'json' } });
45
+ let mdnsIpv4QueryInterval;
46
+ let mdnsIpv6QueryInterval;
47
+ let mdnsIpv4AdvertiseInterval;
48
+ let mdnsIpv6AdvertiseInterval;
46
49
  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'));
47
50
  const mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
48
51
  if (hasParameter('v') || hasParameter('verbose')) {
@@ -59,9 +62,19 @@ Examples:
59
62
  mdnsIpv4.filters.push(...filters);
60
63
  mdnsIpv6.filters.push(...filters);
61
64
  }
62
- function cleanupAndLogAndExit() {
65
+ async function cleanupAndLogAndExit() {
66
+ if (hasParameter('advertise')) {
67
+ advertise(mdnsIpv4, 0);
68
+ advertise(mdnsIpv6, 0);
69
+ }
70
+ await new Promise((resolve) => setTimeout(resolve, 250));
71
+ clearInterval(mdnsIpv4QueryInterval);
72
+ clearInterval(mdnsIpv6QueryInterval);
73
+ clearInterval(mdnsIpv4AdvertiseInterval);
74
+ clearInterval(mdnsIpv6AdvertiseInterval);
63
75
  mdnsIpv4.stop();
64
76
  mdnsIpv6.stop();
77
+ await new Promise((resolve) => setTimeout(resolve, 250));
65
78
  mdnsIpv4.logDevices();
66
79
  mdnsIpv6.logDevices();
67
80
  process.exit(0);
@@ -71,27 +84,35 @@ Examples:
71
84
  mdns.sendQuery([
72
85
  { name: '_matterc._udp.local', type: 12, class: 1, unicastResponse: true },
73
86
  { name: '_matter._tcp.local', type: 12, class: 1, unicastResponse: true },
87
+ { name: '_matterbridge._tcp.local', type: 12, class: 1, unicastResponse: true },
74
88
  { name: '_shelly._tcp.local', type: 12, class: 1, unicastResponse: true },
75
89
  { name: '_http._tcp.local', type: 12, class: 1, unicastResponse: true },
76
90
  { name: '_services._dns-sd._udp.local', type: 12, class: 1, unicastResponse: true },
77
91
  ]);
78
92
  };
79
- const advertise = (mdns) => {
80
- mdns.log.info('Sending mDNS advertisement for matterbridge service...');
81
- const serviceType = '_http._tcp.local';
82
- const instanceName = 'matterbridge._http._tcp.local';
93
+ const advertise = (mdns, ttl = 120) => {
94
+ mdns.log.info(`Sending mDNS advertisement for matterbridge service with TTL ${ttl ? ttl.toString() : 'goodbye'}...`);
95
+ const httpServiceType = '_http._tcp.local';
96
+ const matterbridgeServiceType = '_matterbridge._tcp.local';
97
+ const httpInstanceName = 'matterbridge._http._tcp.local';
98
+ const matterbridgeInstanceName = 'matterbridge._matterbridge._tcp.local';
83
99
  const hostName = 'matterbridge.local';
84
100
  const port = 8283;
85
- const ttl = 120;
86
- const ptrInstanceRdata = mdns.encodeDnsName(instanceName);
87
- const ptrServiceTypeRdata = mdns.encodeDnsName(serviceType);
101
+ const ptrHttpServiceTypeRdata = mdns.encodeDnsName(httpServiceType);
102
+ const ptrMatterbridgeServiceTypeRdata = mdns.encodeDnsName(matterbridgeServiceType);
103
+ const ptrHttpInstanceRdata = mdns.encodeDnsName(httpInstanceName);
104
+ const ptrMatterbridgeInstanceRdata = mdns.encodeDnsName(matterbridgeInstanceName);
88
105
  const srvRdata = mdns.encodeSrvRdata(0, 0, port, hostName);
89
106
  const txtRdata = mdns.encodeTxtRdata([`version=${pkg.version}`, 'path=/']);
90
107
  const answers = [
91
- { name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrServiceTypeRdata },
92
- { name: serviceType, rtype: 12, rclass: 1, ttl, rdata: ptrInstanceRdata },
93
- { name: instanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
94
- { name: instanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
108
+ { name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrHttpServiceTypeRdata },
109
+ { name: httpServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrHttpInstanceRdata },
110
+ { name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
111
+ { name: matterbridgeServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeInstanceRdata },
112
+ { name: httpInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
113
+ { name: matterbridgeInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
114
+ { name: httpInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
115
+ { name: matterbridgeInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
95
116
  ];
96
117
  try {
97
118
  const ipv4 = mdns.getIpv4InterfaceAddress(mdns.interfaceName);
@@ -132,21 +153,21 @@ Examples:
132
153
  }
133
154
  }
134
155
  };
135
- process.on('SIGINT', () => {
136
- cleanupAndLogAndExit();
156
+ process.on('SIGINT', async () => {
157
+ await cleanupAndLogAndExit();
137
158
  });
138
159
  mdnsIpv4.start();
139
160
  mdnsIpv4.on('ready', (address) => {
140
161
  mdnsIpv4.log.info(`mdnsIpv4 server ready on ${address.family} ${address.address}:${address.port}`);
141
162
  if (hasParameter('advertise')) {
142
163
  advertise(mdnsIpv4);
143
- setInterval(() => {
164
+ mdnsIpv4AdvertiseInterval = setInterval(() => {
144
165
  advertise(mdnsIpv4);
145
166
  }, getIntParameter('advertise') || 10000).unref();
146
167
  }
147
168
  if (hasParameter('query')) {
148
169
  query(mdnsIpv4);
149
- setInterval(() => {
170
+ mdnsIpv4QueryInterval = setInterval(() => {
150
171
  query(mdnsIpv4);
151
172
  }, getIntParameter('query') || 10000).unref();
152
173
  }
@@ -156,18 +177,18 @@ Examples:
156
177
  mdnsIpv6.log.info(`mdnsIpv6 server ready on ${address.family} ${address.address}:${address.port}`);
157
178
  if (hasParameter('advertise')) {
158
179
  advertise(mdnsIpv6);
159
- setInterval(() => {
180
+ mdnsIpv6AdvertiseInterval = setInterval(() => {
160
181
  advertise(mdnsIpv6);
161
182
  }, getIntParameter('advertise') || 10000).unref();
162
183
  }
163
184
  if (hasParameter('query')) {
164
185
  query(mdnsIpv6);
165
- setInterval(() => {
186
+ mdnsIpv6QueryInterval = setInterval(() => {
166
187
  query(mdnsIpv6);
167
188
  }, getIntParameter('query') || 10000).unref();
168
189
  }
169
190
  });
170
- setTimeout(() => {
171
- cleanupAndLogAndExit();
172
- }, 600000);
191
+ setTimeout(async () => {
192
+ await cleanupAndLogAndExit();
193
+ }, 600000).unref();
173
194
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.4.5-dev-20251224-457def5",
3
+ "version": "3.4.5-dev-20251224-fd9f02e",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.4.5-dev-20251224-457def5",
9
+ "version": "3.4.5-dev-20251224-fd9f02e",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.15.6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.4.5-dev-20251224-457def5",
3
+ "version": "3.4.5-dev-20251224-fd9f02e",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",