MCPcopy Index your code
hub / github.com/nodejs/node / checkIpAddress

Function checkIpAddress

test/parallel/test-inspector-ip-detection.js:15–23  ·  view source on GitHub ↗
(ip, response)

Source from the content-addressed store, hash-verified

13 common.skip('No IP address found');
14
15function checkIpAddress(ip, response) {
16 const res = response[0];
17 const wsUrl = res.webSocketDebuggerUrl;
18 assert.ok(wsUrl);
19 const match = wsUrl.match(/^ws:\/\/(.*):\d+\/(.*)/);
20 assert.strictEqual(ip, match[1]);
21 assert.strictEqual(res.id, match[2]);
22 assert.strictEqual(ip, res.devtoolsFrontendUrl.match(/.*ws=(.*):\d+/)[1]);
23}
24
25function pickIPv4Address() {
26 for (const i of [].concat(...Object.values(os.networkInterfaces()))) {

Callers 1

testFunction · 0.85

Calls 2

matchMethod · 0.65
okMethod · 0.45

Tested by 1

testFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…