MCPcopy Create free account
hub / github.com/appium/appium / fetchInterfaces

Function fetchInterfaces

packages/http-server/lib/network.ts:15–24  ·  view source on GitHub ↗
(family: 4 | 6 | null = null)

Source from the content-addressed store, hash-verified

13 * @param family - 4 for IPv4, 6 for IPv6, or null for all.
14 */
15export function fetchInterfaces(family: 4 | 6 | null = null): os.NetworkInterfaceInfo[] {
16 let familyValue: (4 | 6 | string)[] | null = null;
17 if (family === 4) {
18 familyValue = [4, 'IPv4'];
19 } else if (family === 6) {
20 familyValue = [6, 'IPv6'];
21 }
22 const ifaces = Object.values(os.networkInterfaces()).filter(Boolean) as os.NetworkInterfaceInfo[][];
23 return ifaces.flat().filter((info) => !familyValue || familyValue.includes(info.family as 4 | 6 | string));
24}
25
26/**
27 * Returns true if the address is a broadcast IP (0.0.0.0 or ::).

Callers 3

determineBiDiHostFunction · 0.90
logServerAddressFunction · 0.85
network.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected