Resolve mDNS host candidates

Browsers and other libwebrtc builds hide their host addresses behind
mDNS names (<uuid>.local) unless they have camera or microphone
permission; the official client may do the same. str0m takes only IP
addresses, so such candidates were dropped (in the SDP silently, trickled
with a debug line), and a LAN connection worked only if the hiding side
happened to start the checks.

Candidates with an mDNS name, in a remote offer or answer or trickled,
are now resolved in the background by a multicast DNS query
(voelin_stream::mdns) and added as plain candidates; ICE takes whichever
pair works. The query goes out from port 5353, shared with the system's
responder, because Chromium's responder ignores queries from other ports
(tried: none answered from an ephemeral port, every one from 5353); where
5353 cannot be shared it goes out from a port of our own.

browser_mdns_candidates_connect runs headless Chromium with the names on
and keeps our candidates from it, so it cannot start the checks: both as
streamer and as viewer the connection comes up and the media flows (with
resolution switched off for a control run it timed out).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 23:21:45 +03:00
1 parent c130c053f8
commit e7af3bd685
6 files changed
+292 -12

No files matched your search

+7 -5
View File
@@ -190,14 +190,16 @@ window.peer = {
`;
async function main() {
const args = ['--autoplay-policy=no-user-gesture-required'];
// Real host candidates instead of mDNS names (no getUserMedia permission
// here), unless the test is about mDNS names (VOELIN_BROWSER_MDNS=1).
if (process.env.VOELIN_BROWSER_MDNS !== '1') {
args.push('--disable-features=WebRtcHideLocalIpsWithMdns');
}
const browser = await chromium.launch({
headless: true,
executablePath: process.env.VOELIN_CHROMIUM || undefined,
args: [
// Real host candidates instead of mDNS names (no getUserMedia permission here).
'--disable-features=WebRtcHideLocalIpsWithMdns',
'--autoplay-policy=no-user-gesture-required',
],
args,
});
const page = await browser.newPage();
page.on('console', (m) => process.stderr.write('[page] ' + m.text() + '\n'));
+13
View File
@@ -25,6 +25,18 @@ pub struct Browser {
impl Browser {
pub async fn start() -> Self {
Self::launch(false).await
}
/// A browser that hides its host addresses behind mDNS names
/// (`<uuid>.local`), as Chromium does without camera or microphone
/// permission.
#[allow(dead_code, reason = "not every test uses it")]
pub async fn start_with_mdns() -> Self {
Self::launch(true).await
}
async fn launch(mdns: bool) -> Self {
let script = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../tests/interop/browser-peer.cjs")
.canonicalize()
@@ -36,6 +48,7 @@ impl Browser {
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::inherit())
.env("VOELIN_BROWSER_MDNS", if mdns { "1" } else { "0" })
.kill_on_drop(true);
// Playwright is usually installed globally.
if std::env::var_os("NODE_PATH").is_none()