ec-node: moq-rs draft-07 for Cloudflare relay

This commit is contained in:
every.channel 2026-02-17 02:26:20 -08:00
parent ce8c1319f4
commit 09246513ab
No known key found for this signature in database
6 changed files with 36 additions and 47 deletions

View file

@ -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]

View file

@ -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")?;