@matterbridge/dgram 3.9.1-dev-20260614-18d1a2e → 3.9.1-dev-20260617-8de71e5
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/README.md +5 -3
- package/dist/coap.js +2 -2
- package/dist/dgram.d.ts +1 -1
- package/dist/dgram.js +3 -3
- package/dist/mdns.d.ts +2 -2
- package/dist/mdns.js +3 -2
- package/dist/multicast.d.ts +1 -1
- package/dist/multicast.js +12 -6
- package/dist/unicast.d.ts +2 -2
- package/dist/unicast.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
[](https://hub.docker.com/r/luligu/matterbridge)
|
|
7
7
|

|
|
8
8
|

|
|
9
|
-
[](https://codecov.io/gh/Luligu/matterbridge)
|
|
10
|
+
[](https://vitest.dev)
|
|
11
|
+
[](https://oxc.rs/docs/guide/usage/formatter.html)
|
|
12
|
+
[](https://oxc.rs/docs/guide/usage/linter.html)
|
|
12
13
|
[](https://www.typescriptlang.org/)
|
|
14
|
+
[](https://github.com/microsoft/typescript-go)
|
|
13
15
|
[](https://nodejs.org/)
|
|
14
16
|
[](https://matterbridge.io)
|
|
15
17
|
|
package/dist/coap.js
CHANGED
|
@@ -215,14 +215,14 @@ export class Coap extends Multicast {
|
|
|
215
215
|
`options ${MAGENTA}${msg.options.length}${nf} payload ${MAGENTA}${msg.payload ? msg.payload.length + ' bytes' : undefined}${nf}`);
|
|
216
216
|
msg.options.forEach((option) => {
|
|
217
217
|
if (option.number === COAP_OPTION_URI_PATH) {
|
|
218
|
-
this.log.info(`Option: COAP_OPTION_URI_PATH => ${GREEN}${option.value}${nf}`);
|
|
218
|
+
this.log.info(`Option: COAP_OPTION_URI_PATH => ${GREEN}${option.value.toString()}${nf}`);
|
|
219
219
|
}
|
|
220
220
|
else if (option.number === COIOT_OPTION_DEVID) {
|
|
221
221
|
const parts = option.value.toString().split('#');
|
|
222
222
|
const deviceModel = parts[0];
|
|
223
223
|
const deviceMac = parts[1];
|
|
224
224
|
const protocolRevision = parts[2];
|
|
225
|
-
this.log.info(`Option: COIOT_OPTION_DEVID => ${option.value} => Model: ${GREEN}${deviceModel}${nf}, MAC: ${GREEN}${deviceMac}${nf}, Protocol: ${GREEN}${protocolRevision}${nf}`);
|
|
225
|
+
this.log.info(`Option: COIOT_OPTION_DEVID => ${option.value.toString()} => Model: ${GREEN}${deviceModel}${nf}, MAC: ${GREEN}${deviceMac}${nf}, Protocol: ${GREEN}${protocolRevision}${nf}`);
|
|
226
226
|
}
|
|
227
227
|
else if (option.number === COIOT_OPTION_SERIAL) {
|
|
228
228
|
const serial = option.value.readUInt16BE(0);
|
package/dist/dgram.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dgram from 'node:dgram';
|
|
2
2
|
import EventEmitter from 'node:events';
|
|
3
|
-
import {
|
|
3
|
+
import type { AddressInfo } from 'node:net';
|
|
4
4
|
import { AnsiLogger } from 'node-ansi-logger';
|
|
5
5
|
export interface DgramEvents {
|
|
6
6
|
error: [error: Error];
|
package/dist/dgram.js
CHANGED
|
@@ -27,7 +27,7 @@ export class Dgram extends EventEmitter {
|
|
|
27
27
|
this.socketType = socketType;
|
|
28
28
|
this.interfaceName = interfaceName;
|
|
29
29
|
this.interfaceAddress = interfaceAddress;
|
|
30
|
-
this.log.debug(`Created socket of type ${BLUE}${socketType}${db} on interface ${BLUE}${interfaceName
|
|
30
|
+
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}`);
|
|
31
31
|
this.socket.on('error', (error) => {
|
|
32
32
|
this.log.debug(`Socket error: ${getErrorMessage(error)}`);
|
|
33
33
|
this.emit('error', error);
|
|
@@ -159,7 +159,7 @@ export class Dgram extends EventEmitter {
|
|
|
159
159
|
const linkLocalAddress = addresses?.find((addr) => addr.family === 'IPv6' && !addr.internal && addr.address.startsWith('fe80'));
|
|
160
160
|
if (linkLocalAddress) {
|
|
161
161
|
this.log.debug('Found IPv6 link-local address');
|
|
162
|
-
return linkLocalAddress.scopeid ? `${linkLocalAddress.address}%${process.platform
|
|
162
|
+
return linkLocalAddress.scopeid ? `${linkLocalAddress.address}%${process.platform === 'win32' ? linkLocalAddress.scopeid : networkInterface}` : linkLocalAddress.address;
|
|
163
163
|
}
|
|
164
164
|
this.log.debug('No IPv6 link-local address found');
|
|
165
165
|
const ulaAddress = addresses?.find((addr) => addr.family === 'IPv6' && !addr.internal && addr.address.startsWith('fd') && addr.netmask === 'ffff:ffff:ffff:ffff::');
|
|
@@ -206,7 +206,7 @@ export class Dgram extends EventEmitter {
|
|
|
206
206
|
getInterfaceNameFromScopeId(scopeId) {
|
|
207
207
|
const nets = os.networkInterfaces();
|
|
208
208
|
for (const ifaceName in nets) {
|
|
209
|
-
const addresses = nets[ifaceName]
|
|
209
|
+
const addresses = nets[ifaceName] ?? [];
|
|
210
210
|
for (const addr of addresses) {
|
|
211
211
|
if (addr.family === 'IPv6' && addr.scopeid === scopeId) {
|
|
212
212
|
return ifaceName;
|
package/dist/mdns.d.ts
CHANGED
package/dist/mdns.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hasParameter } from '@matterbridge/utils/cli';
|
|
2
|
+
import { getErrorMessage } from '@matterbridge/utils/error';
|
|
2
3
|
import { BLUE, CYAN, db, GREEN, idn, MAGENTA, nf, rs } from 'node-ansi-logger';
|
|
3
4
|
import { Multicast } from './multicast.js';
|
|
4
5
|
export var DnsRecordType;
|
|
@@ -186,7 +187,7 @@ export class Mdns extends Multicast {
|
|
|
186
187
|
this.logMdnsMessage(result);
|
|
187
188
|
}
|
|
188
189
|
catch (error) {
|
|
189
|
-
this.log.error(`Error decoding mDNS message: ${error
|
|
190
|
+
this.log.error(`Error decoding mDNS message: ${getErrorMessage(error)}`);
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
decodeMdnsMessage(msg) {
|
|
@@ -509,7 +510,7 @@ export class Mdns extends Multicast {
|
|
|
509
510
|
}
|
|
510
511
|
this.socket.send(response, 0, response.length, this.multicastPort, this.multicastAddress, (error) => {
|
|
511
512
|
if (error) {
|
|
512
|
-
this.log.error(`Dgram mDNS server failed to send response message: ${error
|
|
513
|
+
this.log.error(`Dgram mDNS server failed to send response message: ${getErrorMessage(error)}`);
|
|
513
514
|
this.emit('error', error);
|
|
514
515
|
}
|
|
515
516
|
else {
|
package/dist/multicast.d.ts
CHANGED
package/dist/multicast.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
|
+
import { getErrorMessage } from '@matterbridge/utils/error';
|
|
2
3
|
import { BLUE, CYAN, db, RED, YELLOW } from 'node-ansi-logger';
|
|
3
4
|
import { Dgram } from './dgram.js';
|
|
4
5
|
export const MDNS_MULTICAST_IPV4_ADDRESS = '224.0.0.251';
|
|
@@ -85,20 +86,25 @@ export class Multicast extends Dgram {
|
|
|
85
86
|
this.log.debug(`Dgram multicast socket joined multicast group ${BLUE}${this.multicastAddress}${db} on interface ${CYAN}${name}${db} ${BLUE}${iface.family}${db} ${BLUE}${iface.address}${db} ${BLUE}${iface.scopeid}${db} >>> ${YELLOW}${membershipInterface}${db}`);
|
|
86
87
|
}
|
|
87
88
|
catch (error) {
|
|
88
|
-
this.log.debug(`Dgram multicast socket failed to join multicast group ${BLUE}${this.multicastAddress}${db} on interface ${CYAN}${name}${db} ${BLUE}${iface.family}${db} ${BLUE}${iface.address}${db} ${BLUE}${iface.scopeid}${db} >>> ${RED}${membershipInterface}${db}: ${error
|
|
89
|
+
this.log.debug(`Dgram multicast socket failed to join multicast group ${BLUE}${this.multicastAddress}${db} on interface ${CYAN}${name}${db} ${BLUE}${iface.family}${db} ${BLUE}${iface.address}${db} ${BLUE}${iface.scopeid}${db} >>> ${RED}${membershipInterface}${db}: ${getErrorMessage(error)}`);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
});
|
|
92
|
-
let interfaceAddress = this.outgoingInterfaceAddress
|
|
93
|
+
let interfaceAddress = this.outgoingInterfaceAddress ?? this.interfaceAddress;
|
|
93
94
|
if (!this.outgoingInterfaceAddress && this.socketType === 'udp4' && this.interfaceAddress === '0.0.0.0') {
|
|
94
95
|
interfaceAddress = this.getIpv4InterfaceAddress(this.interfaceName);
|
|
95
96
|
}
|
|
96
97
|
if (!this.outgoingInterfaceAddress && this.socketType === 'udp6' && this.interfaceAddress === '::') {
|
|
97
98
|
interfaceAddress = '::' + this.getIpv6ScopeId(this.interfaceName);
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if (interfaceAddress) {
|
|
101
|
+
this.log.debug(`Dgram multicast socket setting multicastInterface to ${BLUE}${interfaceAddress}${db} for ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
|
|
102
|
+
this.socket.setMulticastInterface(interfaceAddress);
|
|
103
|
+
this.log.debug(`Dgram multicast socket multicastInterface set to ${BLUE}${interfaceAddress}${db}`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.log.debug(`Dgram multicast socket no outgoing interface address resolved; using system default multicast interface`);
|
|
107
|
+
}
|
|
102
108
|
this.emit('ready', address);
|
|
103
109
|
}
|
|
104
110
|
stop() {
|
|
@@ -109,7 +115,7 @@ export class Multicast extends Dgram {
|
|
|
109
115
|
this.log.debug(`Dgram multicast socket dropped multicast group ${BLUE}${this.multicastAddress}${db} on interface ${YELLOW}${membershipInterface}${db}`);
|
|
110
116
|
}
|
|
111
117
|
catch (error) {
|
|
112
|
-
this.log.debug(`Dgram multicast socket failed to drop multicast group ${BLUE}${this.multicastAddress}${db} on interface ${RED}${membershipInterface}${db}: ${error}`);
|
|
118
|
+
this.log.debug(`Dgram multicast socket failed to drop multicast group ${BLUE}${this.multicastAddress}${db} on interface ${RED}${membershipInterface}${db}: ${getErrorMessage(error)}`);
|
|
113
119
|
}
|
|
114
120
|
});
|
|
115
121
|
this.joinedInterfaces = [];
|
package/dist/unicast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { RemoteInfo } from 'node:dgram';
|
|
2
|
+
import type { AddressInfo } from 'node:net';
|
|
3
3
|
import { Dgram } from './dgram.js';
|
|
4
4
|
export declare class Unicast extends Dgram {
|
|
5
5
|
port: number | undefined;
|
package/dist/unicast.js
CHANGED
|
@@ -16,7 +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
|
|
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}...`);
|
|
20
20
|
this.socket.bind(this.port, this.interfaceAddress, () => {
|
|
21
21
|
const address = this.socket.address();
|
|
22
22
|
this.log.debug(`Dgram unicast socket bound to ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/dgram",
|
|
3
|
-
"version": "3.9.1-dev-
|
|
3
|
+
"version": "3.9.1-dev-20260617-8de71e5",
|
|
4
4
|
"description": "Matterbridge dgram library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"CHANGELOG.md"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@matterbridge/utils": "3.9.1-dev-
|
|
65
|
-
"node-ansi-logger": "3.3.0-dev-
|
|
64
|
+
"@matterbridge/utils": "3.9.1-dev-20260617-8de71e5",
|
|
65
|
+
"node-ansi-logger": "3.3.0-dev-20260617-6ebcff7"
|
|
66
66
|
}
|
|
67
67
|
}
|