From 01216012b3757f39a2cd2888996bf685faf04e20 Mon Sep 17 00:00:00 2001 From: Hans Tool Date: Sun, 4 Jun 2023 20:52:24 +0200 Subject: [PATCH 1/4] Do not include network aliases (identified by same MAC) --- lib/server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/server.ts b/lib/server.ts index cdb1d1d0..5ec96e0f 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -64,12 +64,14 @@ function allAddresses (type): string[] { family = 'IPv6' } const addresses: string[] = [] + const macs: string[] = [] const interfaces = os.networkInterfaces() for (const ifname in interfaces) { if (ifname in interfaces) { interfaces[ifname]?.forEach((a) => { - if (a.family === family) { + if (a.family === family && macs.includes(a.mac) == false) { addresses.push(a.address) + macs.push(a.address) } }) } From 6c684670410fce29efc2d42692074e4e03b81ea0 Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 5 Jun 2023 12:07:19 +0200 Subject: [PATCH 2/4] Update lib/server.ts Co-authored-by: Jan Romann --- lib/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.ts b/lib/server.ts index 5ec96e0f..324b0e0e 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -69,7 +69,7 @@ function allAddresses (type): string[] { for (const ifname in interfaces) { if (ifname in interfaces) { interfaces[ifname]?.forEach((a) => { - if (a.family === family && macs.includes(a.mac) == false) { + if (a.family === family && !macs.includes(a.mac)) { addresses.push(a.address) macs.push(a.address) } From 1b810501680639e8174560e72eacc3e35feed2a2 Mon Sep 17 00:00:00 2001 From: Hans Date: Tue, 6 Jun 2023 16:14:55 +0200 Subject: [PATCH 3/4] Update lib/server.ts Co-authored-by: Jan Romann --- lib/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.ts b/lib/server.ts index 324b0e0e..85bf2ffe 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -71,7 +71,7 @@ function allAddresses (type): string[] { interfaces[ifname]?.forEach((a) => { if (a.family === family && !macs.includes(a.mac)) { addresses.push(a.address) - macs.push(a.address) + macs.push(a.mac) } }) } From 748e79911cea3f44b744dbe7f3fa378a6f7e418d Mon Sep 17 00:00:00 2001 From: Hans Date: Tue, 4 Jun 2024 09:22:49 +0200 Subject: [PATCH 4/4] Update server.ts --- lib/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/server.ts b/lib/server.ts index 85bf2ffe..d655feba 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -69,6 +69,7 @@ function allAddresses (type): string[] { for (const ifname in interfaces) { if (ifname in interfaces) { interfaces[ifname]?.forEach((a) => { + // Checking for repeating MAC address to avoid trying to listen on same interface twice if (a.family === family && !macs.includes(a.mac)) { addresses.push(a.address) macs.push(a.mac)