MCPcopy Create free account
hub / github.com/develop202/migu_video / getLocalIPv

Function getLocalIPv

utils/net.js:4–24  ·  view source on GitHub ↗
(ver = 4)

Source from the content-addressed store, hash-verified

2import { printRed } from "./colorOut.js";
3
4function getLocalIPv(ver = 4) {
5 const ips = []
6 const inter = os.networkInterfaces()
7 // console.dir(inter, { depth: null })
8 for (let net in inter) {
9
10 // console.dir(net, { depth: null })
11 // console.log()
12 for (let netPort of inter[net]) {
13 // netPort = inter[net][netPort]
14 // console.dir(netPort, { depth: null })
15 if (netPort.family === `IPv${ver}`) {
16 // console.dir(netPort, { depth: null })
17 ips.push(netPort.address)
18 }
19 }
20 }
21 // console.log()
22 // console.dir(ips, { depth: null })
23 return ips
24}
25
26async function fetchUrl(url, opts = {}, timeout = 6000) {
27 const controller = new AbortController();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected