MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / lanUrls

Function lanUrls

src/artifacts/live-share.ts:13–25  ·  view source on GitHub ↗
(port: number, token?: string)

Source from the content-addressed store, hash-verified

11
12/** This machine's non-internal IPv4 addresses → shareable LAN URLs (same network only). */
13export function lanUrls(port: number, token?: string): string[] {
14 const suffix = token ? `?k=${token}` : '';
15 const out: string[] = [];
16 for (const addrs of Object.values(os.networkInterfaces())) {
17 for (const a of addrs ?? []) {
18 // Node 18+ reports family as 'IPv4' (string); older as 4 (number) — accept both.
19 if ((a.family === 'IPv4' || (a.family as unknown) === 4) && !a.internal) {
20 out.push(`http://${a.address}:${port}/${suffix}`);
21 }
22 }
23 }
24 return out;
25}
26
27/** Pull the public https URL out of a cloudflared/ngrok log line. Pure → unit-testable. */
28export function parseTunnelUrl(text: string): string | undefined {

Callers 2

startLiveFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected