diff options
Diffstat (limited to 'packages/meshbay-client/src/main.js')
| -rw-r--r-- | packages/meshbay-client/src/main.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/meshbay-client/src/main.js b/packages/meshbay-client/src/main.js index 2a97246..9c27cfe 100644 --- a/packages/meshbay-client/src/main.js +++ b/packages/meshbay-client/src/main.js @@ -40,6 +40,17 @@ const { pathToFileURL } = require('node:url'); // runs (`electron .`) consistent with it. app.commandLine.appendSwitch('class', 'MeshBay'); +// TEST-ENV WORKAROUND (Windows libvirt/KVM guest) — REVISIT BEFORE RELEASE. +// In that guest Chromium hides the host candidate behind a random `.local` +// mDNS name that the node's ICE stack cannot resolve across the KVM bridge, +// so the one working candidate pair is present on some attempts and missing +// on others (60 s ICE timeouts, "2nd connection hangs"). Publishing the real +// local IP removes the dependency. Scoped to win32 so it changes nothing on +// Linux/macOS, where mDNS concealment works and should stay on. +if (process.platform === 'win32') { + app.commandLine.appendSwitch('disable-features', 'WebRtcHideLocalIpsWithMdns'); +} + const UI_DIR = path.join(__dirname, '..', 'ui'); const SCHEME = 'app'; @@ -497,6 +508,23 @@ function registerBridge() { }; }); + ipcMain.handle('ice:resolve-stun', async (_e, urls) => { + const dns = require('node:dns').promises; + const list = Array.isArray(urls) ? urls : []; + const out = []; + for (const u of list) { + const m = /^(stuns?):(\[?[^\]]+\]?|[^:]+):(\d+)$/.exec(String(u)); + if (!m) { out.push(String(u)); continue; } + const [, scheme, host, port] = m; + if (/^[\d.]+$/.test(host) || host.includes(':')) { out.push(String(u)); continue; } + try { + const [ip] = await dns.resolve4(host); + if (ip) out.push(`${scheme}:${ip}:${port}`); + } catch { /* unresolvable (e.g. a decommissioned host) — drop it */ } + } + return out; + }); + ipcMain.handle('hub:probe', async (_e, url) => { const target = String(url || config.hubBase || '').replace(/\/+$/, ''); if (!target) return null; |