| 115 | /** This machine's tailnet IPv4 (100.x.y.z), from interfaces — works even |
| 116 | * when the tailscale CLI is a broken shim. */ |
| 117 | const tailnetIp = (): string | undefined => { |
| 118 | for (const addrs of Object.values(networkInterfaces())) { |
| 119 | for (const addr of addrs ?? []) { |
| 120 | if (addr.family === "IPv4" && addr.address.startsWith("100.")) return addr.address; |
| 121 | } |
| 122 | } |
| 123 | return undefined; |
| 124 | }; |
| 125 | |
| 126 | const tailnetDnsName = async (ts: string): Promise<string | undefined> => { |
| 127 | const { ok, out } = await sh(ts, ["status", "--json"]); |