wt: use cdn relay defaults and native setup before overrides

This commit is contained in:
every.channel 2026-02-21 01:34:51 -08:00
parent 0c76f33333
commit 5bce56ee79
No known key found for this signature in database
5 changed files with 20 additions and 10 deletions

View file

@ -4446,11 +4446,21 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> {
.await
.context("failed WebTransport CONNECT")?;
// Establish a MoQ session. Cloudflare's relay currently does not always include a selected
// subprotocol in the CONNECT response, so we attempt a few protocol overrides to select
// the correct IETF draft encoding for SETUP.
// Establish a MoQ session. First try native negotiation as-selected by the relay.
// If that fails, fall back to explicit protocol overrides for relays that omit protocol
// selection in CONNECT responses.
let client = moq_lite::Client::new().with_publish(publish);
match client.connect(wt.clone()).await {
Ok(session) => {
tracing::info!("connected to relay (native protocol negotiation)");
return Ok(session);
}
Err(err) => {
tracing::debug!(err = %err, "native MoQ SETUP failed; trying protocol overrides");
}
}
// These correspond to IETF draft ALPNs as used by moq-lite/web code.
// We use string literals here since moq-lite does not currently expose these constants.
let attempts: [&str; 4] = ["moqt-16", "moqt-15", "moq-00", ""];