@matterbridge/dgram 3.7.1-dev-20260324-7b86640 → 3.7.1-dev-20260325-72b7b24

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/coap.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { getErrorMessage } from '@matterbridge/utils/error';
1
2
  import { BLUE, db, GREEN, MAGENTA, nf } from 'node-ansi-logger';
2
3
  import { COAP_MULTICAST_IPV4_ADDRESS, COAP_MULTICAST_PORT, Multicast } from './multicast.js';
3
4
  export const COAP_OPTION_URI_PATH = 11;
@@ -21,7 +22,7 @@ export class Coap extends Multicast {
21
22
  this.logCoapMessage(result);
22
23
  }
23
24
  catch (error) {
24
- this.log.error(`Error decoding CoAP message: ${error instanceof Error ? error.message : error}`);
25
+ this.log.error(`Error decoding CoAP message: ${getErrorMessage(error)}`);
25
26
  }
26
27
  }
27
28
  decodeCoapMessage(msg) {
package/dist/dgram.js CHANGED
@@ -2,6 +2,7 @@ import dgram from 'node:dgram';
2
2
  import EventEmitter from 'node:events';
3
3
  import os from 'node:os';
4
4
  import { hasParameter } from '@matterbridge/utils/cli';
5
+ import { getErrorMessage } from '@matterbridge/utils/error';
5
6
  import { AnsiLogger, BLUE, db, idn, nf, rs } from 'node-ansi-logger';
6
7
  export class Dgram extends EventEmitter {
7
8
  verbose = hasParameter('v') || hasParameter('verbose');
@@ -28,7 +29,7 @@ export class Dgram extends EventEmitter {
28
29
  this.interfaceAddress = interfaceAddress;
29
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}`);
30
31
  this.socket.on('error', (error) => {
31
- this.log.debug(`Socket error: ${error instanceof Error ? error.message : error}`);
32
+ this.log.debug(`Socket error: ${getErrorMessage(error)}`);
32
33
  this.emit('error', error);
33
34
  this.onError(error);
34
35
  });
@@ -59,7 +60,7 @@ export class Dgram extends EventEmitter {
59
60
  send(msg, serverAddress, serverPort) {
60
61
  this.socket.send(msg, 0, msg.length, serverPort, serverAddress, (error) => {
61
62
  if (error) {
62
- this.log.error(`Socket failed to send a message: ${error instanceof Error ? error.message : error}`);
63
+ this.log.error(`Socket failed to send a message: ${getErrorMessage(error)}`);
63
64
  this.emit('error', error);
64
65
  this.onError(error);
65
66
  }
@@ -71,7 +72,7 @@ export class Dgram extends EventEmitter {
71
72
  });
72
73
  }
73
74
  onError(error) {
74
- this.log.error(`Socket error: ${error instanceof Error ? error.message : error}`);
75
+ this.log.error(`Socket error: ${getErrorMessage(error)}`);
75
76
  }
76
77
  onClose() {
77
78
  this.log.info(`Socket closed`);
package/dist/mdns.js CHANGED
@@ -151,7 +151,7 @@ export class Mdns extends Multicast {
151
151
  }
152
152
  }
153
153
  if (this.filters.length === 0)
154
- this.log.info(`Dgram mDNS server received a mDNS message from ${BLUE}${rinfo.family}${nf} ${BLUE}${rinfo.address}${nf}:${BLUE}${rinfo.port}${nf}`);
154
+ this.log.info(`Dgram mDNS server received a mDNS message (${msg.length} bytes) from ${BLUE}${rinfo.family}${nf} ${BLUE}${rinfo.address}${nf}:${BLUE}${rinfo.port}${nf}`);
155
155
  try {
156
156
  const result = this.decodeMdnsMessage(msg);
157
157
  if (result.qr === 0) {
@@ -175,7 +175,7 @@ export class Mdns extends Multicast {
175
175
  const foundInAnswers = result.answers?.some((a) => a.name.includes(filter) || a.data.includes(filter));
176
176
  const foundInAdditionals = result.additionals?.some((a) => a.name.includes(filter) || a.data.includes(filter));
177
177
  if (foundInQuestions || foundInAnswers || foundInAdditionals) {
178
- this.log.info(`Dgram mDNS server received a mDNS message from ${BLUE}${rinfo.family}${nf} ${BLUE}${rinfo.address}${nf}:${BLUE}${rinfo.port}${nf}`);
178
+ this.log.info(`Dgram mDNS server received a mDNS message (${msg.length} bytes) from ${BLUE}${rinfo.family}${nf} ${BLUE}${rinfo.address}${nf}:${BLUE}${rinfo.port}${nf}`);
179
179
  this.logMdnsMessage(result);
180
180
  return;
181
181
  }
@@ -468,7 +468,7 @@ export class Mdns extends Multicast {
468
468
  const query = Buffer.concat([header, ...questionBuffers]);
469
469
  if (hasParameter('v') || hasParameter('verbose')) {
470
470
  const decoded = this.decodeMdnsMessage(query);
471
- this.logMdnsMessage(decoded, undefined, 'Sending query mDNS message');
471
+ this.logMdnsMessage(decoded, undefined, `Sending query mDNS message (${query.length} bytes)`);
472
472
  }
473
473
  this.socket.send(query, 0, query.length, this.multicastPort, this.multicastAddress, (error) => {
474
474
  if (error) {
@@ -505,7 +505,7 @@ export class Mdns extends Multicast {
505
505
  const response = Buffer.concat([header, ...answerBuffers]);
506
506
  if (hasParameter('v') || hasParameter('verbose')) {
507
507
  const decoded = this.decodeMdnsMessage(response);
508
- this.logMdnsMessage(decoded, undefined, 'Sending response mDNS message');
508
+ this.logMdnsMessage(decoded, undefined, `Sending response mDNS message (${response.length} bytes)`);
509
509
  }
510
510
  this.socket.send(response, 0, response.length, this.multicastPort, this.multicastAddress, (error) => {
511
511
  if (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/dgram",
3
- "version": "3.7.1-dev-20260324-7b86640",
3
+ "version": "3.7.1-dev-20260325-72b7b24",
4
4
  "description": "Matterbridge dgram library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",
@@ -61,7 +61,8 @@
61
61
  "CHANGELOG.md"
62
62
  ],
63
63
  "dependencies": {
64
- "@matterbridge/jest-utils": "3.7.1-dev-20260324-7b86640",
64
+ "@matterbridge/jest-utils": "3.7.1-dev-20260325-72b7b24",
65
+ "@matterbridge/utils": "3.7.1-dev-20260325-72b7b24",
65
66
  "node-ansi-logger": "3.2.0"
66
67
  }
67
68
  }