MCPcopy Create free account
hub / github.com/6174/comflowyspace / getLocalIP

Function getLocalIP

apps/node/src/modules/utils/get-device-ip.ts:2–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import * as os from "os";
2export function getLocalIP() {
3 const interfaces = os.networkInterfaces();
4 const result = [];
5
6 for (const interfaceName in interfaces) {
7 const interfaceInfo = interfaces[interfaceName]!;
8
9 for (const info of interfaceInfo) {
10 if (info.family === 'IPv4' && info.address !== '127.0.0.1') {
11 result.push(info.address);
12 }
13 }
14 }
15
16 return result;
17 }
18
19// const localIPs = getLocalIP();
20// logger.info('Local IP Addresses:', localIPs);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected