Skip to content

Commit b233e94

Browse files
authored
Clarify IPv4 family check in LAN scanner
1 parent 90286ec commit b233e94

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github-minimum-intelligence/lifecycle/local-chat.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,9 +1561,10 @@ function hostIPv4Prefixes(): string[] {
15611561
const nets = networkInterfaces();
15621562
for (const name of Object.keys(nets)) {
15631563
for (const ni of nets[name] ?? []) {
1564-
// Node <18 reports `family` as a string ("IPv4"); newer versions may
1564+
// Node typings declare `family` as a string ("IPv4"); some runtimes
15651565
// report the number 4. Accept both, and skip loopback/internal NICs.
1566-
const isV4 = ni.family === "IPv4" || (ni.family as unknown) === 4;
1566+
const fam = ni.family as unknown;
1567+
const isV4 = fam === "IPv4" || fam === 4;
15671568
if (!isV4 || ni.internal) continue;
15681569
const parts = ni.address.split(".");
15691570
if (parts.length !== 4) continue;

0 commit comments

Comments
 (0)