@matterbridge/dgram 0.0.1 → 0.0.2

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.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare class Dgram extends EventEmitter<DgramEvents> {
23
23
  interfaceName?: string;
24
24
  interfaceAddress?: string;
25
25
  interfaceNetmask?: string;
26
+ excludedInterfaceNamePattern: RegExp;
26
27
  constructor(name: string, socketType: 'udp4' | 'udp6', reuseAddr?: boolean | undefined, interfaceName?: string, interfaceAddress?: string);
27
28
  send(msg: Buffer, serverAddress: string, serverPort: number): void;
28
29
  onError(error: Error): void;
package/dist/dgram.js CHANGED
@@ -14,6 +14,7 @@ export class Dgram extends EventEmitter {
14
14
  interfaceName;
15
15
  interfaceAddress;
16
16
  interfaceNetmask;
17
+ excludedInterfaceNamePattern = /(tailscale|wireguard|wintun|openvpn|\bwg\d*\b|\btun\d*\b|\btap\d*\b|\butun\d*\b|zerotier|hamachi|hyper-?v|v\s*ethernet|wsl|default switch|vmware|vmnet|vbox|virtualbox|virbr|docker|podman|\bveth\b|\bbr-\b|cni|kube|flannel|calico|teredo|isatap)/i;
17
18
  constructor(name, socketType, reuseAddr = true, interfaceName, interfaceAddress) {
18
19
  super();
19
20
  this.log = new AnsiLogger({
@@ -102,7 +103,7 @@ export class Dgram extends EventEmitter {
102
103
  }
103
104
  if (!networkInterface) {
104
105
  for (const [interfaceName, interfaceDetails] of Object.entries(interfaces)) {
105
- if (interfaceName.toLowerCase().includes('tailscale'))
106
+ if (!networkInterface && this.excludedInterfaceNamePattern.test(interfaceName))
106
107
  continue;
107
108
  if (!interfaceDetails)
108
109
  continue;
@@ -136,7 +137,7 @@ export class Dgram extends EventEmitter {
136
137
  }
137
138
  if (!networkInterface) {
138
139
  for (const [interfaceName, interfaceDetails] of Object.entries(interfaces)) {
139
- if (interfaceName.toLowerCase().includes('tailscale'))
140
+ if (!networkInterface && this.excludedInterfaceNamePattern.test(interfaceName))
140
141
  continue;
141
142
  if (!interfaceDetails)
142
143
  continue;
@@ -189,6 +190,8 @@ export class Dgram extends EventEmitter {
189
190
  for (const name in interfaces) {
190
191
  if (interfaceName && name !== interfaceName)
191
192
  continue;
193
+ if (!interfaceName && this.excludedInterfaceNamePattern.test(name))
194
+ continue;
192
195
  const iface = interfaces[name];
193
196
  if (iface) {
194
197
  const ipv6Address = iface.find((addr) => addr.family === 'IPv6' && !addr.internal && addr.scopeid);
package/dist/multicast.js CHANGED
@@ -75,7 +75,8 @@ export class Multicast extends Dgram {
75
75
  const ifaceLinkLocal = interfaces.find((iface) => iface.family === 'IPv6' && this.socketType === 'udp6' && iface.address.startsWith('fe80'));
76
76
  if (ifaceLinkLocal) {
77
77
  iface = ifaceLinkLocal;
78
- membershipInterface = ifaceLinkLocal.address + (ifaceLinkLocal.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceLinkLocal.scopeid) : '%' + name) : '');
78
+ membershipInterface =
79
+ ifaceLinkLocal.address + (ifaceLinkLocal.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceLinkLocal.scopeid) : '%' + name) : '');
79
80
  }
80
81
  if (iface && membershipInterface) {
81
82
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/dgram",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Matterbridge dgram library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "repository": {
@@ -26,8 +26,11 @@
26
26
  "import": "./dist/export.js"
27
27
  }
28
28
  },
29
+ "engines": {
30
+ "node": ">=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
31
+ },
29
32
  "dependencies": {
30
- "@matterbridge/jest-utils": "^0.0.1",
33
+ "@matterbridge/jest-utils": "0.0.1",
31
34
  "node-ansi-logger": "3.1.1"
32
35
  }
33
36
  }