diff --git a/Cargo.lock b/Cargo.lock index 15178ba..9d963a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4157,8 +4157,7 @@ dependencies = [ [[package]] name = "moq-catalog" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b9cf3655b840e98b6527e75975b9406560bdd20a637223e653f04464e114f17" +source = "git+https://github.com/cloudflare/moq-rs?branch=draft-ietf-moq-transport-07#ebc843de8504e37d36c3134a1181513ebdf7a34a" dependencies = [ "serde", ] @@ -4260,9 +4259,8 @@ dependencies = [ [[package]] name = "moq-native-ietf" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e8e6cb8df625bcf7c5e09d18b155467aa36fe84a47b95af55b485f5613fd91c" +version = "0.5.4" +source = "git+https://github.com/cloudflare/moq-rs?branch=draft-ietf-moq-transport-07#ebc843de8504e37d36c3134a1181513ebdf7a34a" dependencies = [ "anyhow", "clap", @@ -4271,7 +4269,6 @@ dependencies = [ "log", "moq-transport", "quinn", - "rand 0.8.5", "ring", "rustls", "rustls-native-certs 0.7.3", @@ -4285,9 +4282,8 @@ dependencies = [ [[package]] name = "moq-pub" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47f3c2fbd884037543088a44c36d8a82388a3c38fde13c4e1946f61b94f0d45" +version = "0.8.4" +source = "git+https://github.com/cloudflare/moq-rs?branch=draft-ietf-moq-transport-07#ebc843de8504e37d36c3134a1181513ebdf7a34a" dependencies = [ "anyhow", "bytes", @@ -4308,20 +4304,15 @@ dependencies = [ [[package]] name = "moq-transport" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2f896962af0634a5b71f274a07590fbbe21f30c89d986066479078644b477" +version = "0.10.0" +source = "git+https://github.com/cloudflare/moq-rs?branch=draft-ietf-moq-transport-07#ebc843de8504e37d36c3134a1181513ebdf7a34a" dependencies = [ "bytes", "futures", "log", "paste", - "serde", - "serde_json", - "serde_with", "thiserror 1.0.69", "tokio", - "uuid", "web-transport", ] @@ -5703,18 +5694,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "qlog" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f15b83c59e6b945f2261c95a1dd9faf239187f32ff0a96af1d1d28c4557f919" -dependencies = [ - "serde", - "serde_json", - "serde_with", - "smallvec", -] - [[package]] name = "quick-xml" version = "0.38.4" @@ -5755,7 +5734,6 @@ dependencies = [ "fastbloom", "getrandom 0.3.4", "lru-slab", - "qlog", "rand 0.9.2", "ring", "rustc-hash", @@ -6631,7 +6609,6 @@ version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ - "indexmap 2.13.0", "itoa", "memchr", "serde", @@ -6889,9 +6866,6 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -dependencies = [ - "serde", -] [[package]] name = "smol_str" diff --git a/crates/ec-node/Cargo.toml b/crates/ec-node/Cargo.toml index f05bbbd..996f034 100644 --- a/crates/ec-node/Cargo.toml +++ b/crates/ec-node/Cargo.toml @@ -32,9 +32,9 @@ tracing-subscriber.workspace = true hang = "0.14.0" moq-mux = "0.2.1" moq-native = { version = "0.13.1", default-features = true } -moq-native-ietf = "0.7.1" -moq-pub = "0.8.8" -moq-transport = "0.12.2" +moq-native-ietf = { git = "https://github.com/cloudflare/moq-rs", branch = "draft-ietf-moq-transport-07" } +moq-pub = { git = "https://github.com/cloudflare/moq-rs", branch = "draft-ietf-moq-transport-07" } +moq-transport = { git = "https://github.com/cloudflare/moq-rs", branch = "draft-ietf-moq-transport-07" } url = "2" [dev-dependencies] diff --git a/crates/ec-node/src/main.rs b/crates/ec-node/src/main.rs index 45ff444..698f776 100644 --- a/crates/ec-node/src/main.rs +++ b/crates/ec-node/src/main.rs @@ -4229,26 +4229,29 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> { let relay_url = Url::parse(&args.url) .with_context(|| format!("invalid relay url: {}", args.url))?; - // Cloudflare's relay currently implements a subset of the IETF MoQ Transport draft-07. - // Use moq-transport (via moq-native-ietf) for interoperability. + // Cloudflare's public relay currently implements a subset of the IETF MoQ Transport draft-07. + // The upstream (newer-draft) moq stack does not interop; use the draft-07 compatibility + // implementation from the moq-rs repository. let mut tls_args = moq_native_ietf::tls::Args::default(); tls_args.disable_verify = args.tls_disable_verify; let tls = tls_args.load().context("failed to load TLS config")?; - let bind: std::net::SocketAddr = "[::]:0".parse().expect("valid bind addr"); - let quic = moq_native_ietf::quic::Endpoint::new(moq_native_ietf::quic::Config::new( - bind, None, tls, - )) + let quic = moq_native_ietf::quic::Endpoint::new(moq_native_ietf::quic::Config { + bind: "[::]:0".parse().expect("valid bind addr"), + tls, + }) .context("failed to init moq-native-ietf endpoint")?; - let namespace = moq_transport::coding::TrackNamespace::from_utf8_path(&args.name); - let (writer, _, reader) = moq_transport::serve::Tracks::new(namespace).produce(); + let (writer, _, reader) = moq_transport::serve::Tracks::new( + moq_transport::coding::Tuple::from_utf8_path(&args.name), + ) + .produce(); let mut media = moq_pub::Media::new(writer).context("failed to init moq-pub media parser")?; tracing::info!(url=%relay_url, name=%args.name, "connecting to relay"); - let (session, _cid) = quic + let session = quic .client - .connect(&relay_url, None) + .connect(&relay_url) .await .context("failed to connect to relay")?; diff --git a/evolution/proposals/ECP-0063-cloudflare-moq-webtransport.md b/evolution/proposals/ECP-0063-cloudflare-moq-webtransport.md index 00e4641..caea0e9 100644 --- a/evolution/proposals/ECP-0063-cloudflare-moq-webtransport.md +++ b/evolution/proposals/ECP-0063-cloudflare-moq-webtransport.md @@ -59,6 +59,7 @@ newer draft implementations. Implementation choice: - `ec-node wt-publish` uses `moq-native-ietf` + `moq-transport` + `moq-pub` (fMP4 ingestion) for Cloudflare relay compatibility. +- Pin these crates to the `cloudflare/moq-rs` git branch `draft-ietf-moq-transport-07` until the relay supports newer drafts (crates.io releases observed to fail with `closed by peer`). ### Share link diff --git a/nix/modules/ec-node.nix b/nix/modules/ec-node.nix index 1d08507..033a093 100644 --- a/nix/modules/ec-node.nix +++ b/nix/modules/ec-node.nix @@ -294,7 +294,14 @@ in ${lib.optionalString cfg.tlsDisableVerify "cmd+=(--tls-disable-verify)"} ${extraArgsLine} - exec "''${cmd[@]}" + # Keep the unit alive even if the relay is temporarily unreachable. + # This avoids `switch-to-configuration test` failing due to a unit that exits + # quickly during activation. + trap 'exit 0' INT TERM + while true; do + "''${cmd[@]}" || true + sleep 2 + done ''; }; in diff --git a/nix/pkgs/ec-node.nix b/nix/pkgs/ec-node.nix index ae08534..5072729 100644 --- a/nix/pkgs/ec-node.nix +++ b/nix/pkgs/ec-node.nix @@ -24,6 +24,10 @@ rustPlatform.buildRustPackage { cargoLock = { lockFile = ../../Cargo.lock; + outputHashes = { + # Filled iteratively when git dependencies change. + "moq-catalog-0.2.2" = "sha256-df9KXVBRiNewDJ7ZgGBja81PPnk8vC9TA0bDIG0892o="; + }; }; cargoBuildFlags = [ "-p" "ec-node" ];