From 3daa2f4812f9ae156847381b9ce3c9bbed2c3198 Mon Sep 17 00:00:00 2001 From: kixelated Date: Fri, 16 Jun 2023 20:36:07 -0700 Subject: [PATCH] Cargo layout (#36) Combine moq-transport and moq-media into one crate again. I might regret this because moq is taken on crates.io. --- Cargo.lock | 266 +++++++++++------- Cargo.toml | 4 +- moq-demo/Cargo.toml | 40 +++ {moq-warp => moq-demo}/src/main.rs | 14 +- {moq-warp/src/app => moq-demo/src}/server.rs | 13 +- {moq-warp/src/app => moq-demo/src}/session.rs | 13 +- {moq-warp => moq-transport}/Cargo.lock | 20 +- moq-transport/Cargo.toml | 38 ++- moq-transport/src/coding/duration.rs | 3 +- moq-transport/src/coding/varint.rs | 2 +- moq-transport/src/lib.rs | 2 + moq-warp/Cargo.toml | 52 +--- moq-warp/src/app/mod.rs | 5 - moq-warp/src/lib.rs | 10 +- moq-warp/src/media/mod.rs | 8 - moq-warp/src/{media => }/model.rs | 2 +- moq-warp/src/{media => }/source.rs | 5 +- moq-warp/src/{media => }/watch.rs | 0 18 files changed, 291 insertions(+), 206 deletions(-) create mode 100644 moq-demo/Cargo.toml rename {moq-warp => moq-demo}/src/main.rs (90%) rename {moq-warp/src/app => moq-demo/src}/server.rs (93%) rename {moq-warp/src/app => moq-demo/src}/session.rs (95%) rename {moq-warp => moq-transport}/Cargo.lock (98%) delete mode 100644 moq-warp/src/app/mod.rs delete mode 100644 moq-warp/src/media/mod.rs rename moq-warp/src/{media => }/model.rs (96%) rename moq-warp/src/{media => }/source.rs (99%) rename moq-warp/src/{media => }/watch.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index d1c2e2d..995c672 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,7 +47,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -57,7 +57,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -199,6 +199,22 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpufeatures" version = "0.2.8" @@ -258,7 +274,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -424,20 +440,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h3" -version = "0.0.2" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#fa956e0d44e66c04545741908fcb3690b0890be6" -dependencies = [ - "bytes", - "fastrand", - "futures-util", - "http", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "h3" version = "0.0.2" @@ -452,20 +454,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h3-quinn" -version = "0.0.2" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#fa956e0d44e66c04545741908fcb3690b0890be6" -dependencies = [ - "bytes", - "futures", - "h3 0.0.2 (git+https://github.com/security-union/h3?branch=add-webtransport)", - "quinn", - "quinn-proto", - "tokio", - "tokio-util", -] - [[package]] name = "h3-quinn" version = "0.0.3" @@ -473,27 +461,13 @@ source = "git+https://github.com/hyperium/h3?branch=master#3ef7c1a37b635e8446322 dependencies = [ "bytes", "futures", - "h3 0.0.2 (git+https://github.com/hyperium/h3?branch=master)", + "h3", "quinn", "quinn-proto", "tokio", "tokio-util", ] -[[package]] -name = "h3-webtransport" -version = "0.1.0" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#fa956e0d44e66c04545741908fcb3690b0890be6" -dependencies = [ - "bytes", - "futures-util", - "h3 0.0.2 (git+https://github.com/security-union/h3?branch=add-webtransport)", - "http", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "h3-webtransport" version = "0.1.0" @@ -501,7 +475,7 @@ source = "git+https://github.com/hyperium/h3?branch=master#3ef7c1a37b635e8446322 dependencies = [ "bytes", "futures-util", - "h3 0.0.2 (git+https://github.com/hyperium/h3?branch=master)", + "h3", "http", "pin-project-lite", "tokio", @@ -676,7 +650,7 @@ checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -688,7 +662,7 @@ dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -764,7 +738,26 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "moq-demo" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "env_logger", + "hex", + "log", + "moq-transport", + "moq-warp", + "quinn", + "ring", + "rustls 0.21.2", + "rustls-pemfile", + "tokio", + "warp", ] [[package]] @@ -774,19 +767,12 @@ dependencies = [ "anyhow", "async-trait", "bytes", - "clap", - "env_logger", - "futures", - "h3 0.0.2 (git+https://github.com/security-union/h3?branch=add-webtransport)", - "h3-quinn 0.0.2", - "h3-webtransport 0.1.0 (git+https://github.com/security-union/h3?branch=add-webtransport)", + "h3", + "h3-quinn", + "h3-webtransport", "http", "log", "quinn", - "quinn-proto", - "ring", - "rustls 0.21.2", - "rustls-pemfile", "thiserror", "tokio", ] @@ -796,29 +782,9 @@ name = "moq-warp" version = "0.1.0" dependencies = [ "anyhow", - "bytes", - "clap", - "env_logger", - "futures", - "h3 0.0.2 (git+https://github.com/hyperium/h3?branch=master)", - "h3-quinn 0.0.3", - "h3-webtransport 0.1.0 (git+https://github.com/hyperium/h3?branch=master)", - "hex", - "http", - "log", "moq-transport", "mp4", - "paste", - "quinn", - "quinn-proto", - "ring", - "rustls 0.21.2", - "rustls-pemfile", - "serde", - "serde_json", - "thiserror", "tokio", - "warp", ] [[package]] @@ -912,6 +878,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + [[package]] name = "parking_lot" version = "0.12.1" @@ -935,12 +907,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" - [[package]] name = "percent-encoding" version = "2.3.0" @@ -1023,6 +989,7 @@ dependencies = [ "ring", "rustc-hash", "rustls 0.21.2", + "rustls-native-certs", "slab", "thiserror", "tinyvec", @@ -1039,7 +1006,7 @@ dependencies = [ "libc", "socket2 0.5.3", "tracing", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1139,7 +1106,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1166,6 +1133,18 @@ dependencies = [ "sct", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.2" @@ -1191,6 +1170,15 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -1213,6 +1201,29 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "serde" version = "1.0.164" @@ -1235,9 +1246,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa", "ryu", @@ -1308,7 +1319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1400,7 +1411,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.4.9", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1749,6 +1760,21 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -1764,51 +1790,93 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index da89776..2f6f7f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] - members = [ "moq-transport", - "moq-warp" + "moq-demo", + "moq-warp", ] diff --git a/moq-demo/Cargo.toml b/moq-demo/Cargo.toml new file mode 100644 index 0000000..ba2d724 --- /dev/null +++ b/moq-demo/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "moq-demo" +description = "Media over QUIC" +authors = [ "Luke Curley" ] +repository = "https://github.com/kixelated/moq-rs" +license = "Apache-2.0" + +version = "0.1.0" +edition = "2021" + +keywords = [ "quic", "http3", "webtransport", "media", "live" ] +categories = [ "multimedia", "network-programming", "web-programming" ] + + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +moq-transport = { path = "../moq-transport" } +moq-warp = { path = "../moq-warp" } + +# QUIC +quinn = "0.10" + +# Crypto +ring = "0.16.20" +rustls = "0.21.2" +rustls-pemfile = "1.0.2" + +# Async stuff +tokio = { version = "1.27", features = ["full"] } + +# Web server to serve the fingerprint +warp = { version = "0.3.3", features = ["tls"] } +hex = "0.4.3" + +# Logging +clap = { version = "4.0", features = [ "derive" ] } +log = { version = "0.4", features = ["std"] } +env_logger = "0.9.3" +anyhow = "1.0.70" diff --git a/moq-warp/src/main.rs b/moq-demo/src/main.rs similarity index 90% rename from moq-warp/src/main.rs rename to moq-demo/src/main.rs index 123e946..7bac619 100644 --- a/moq-warp/src/main.rs +++ b/moq-demo/src/main.rs @@ -1,4 +1,8 @@ -use moq_warp::{app, media}; +mod server; +mod session; + +use server::*; + use std::{fs, io, net, path, sync}; use std::collections::HashMap; @@ -9,6 +13,8 @@ use clap::Parser; use ring::digest::{digest, SHA256}; use warp::Filter; +use moq_warp::Source; + /// Search for a pattern in a file and display the lines that contain it. #[derive(Parser, Clone)] struct Cli { @@ -39,20 +45,20 @@ async fn main() -> anyhow::Result<()> { let serve = serve_http(args.clone()); // Create a fake media source from disk. - let mut media = media::Source::new(args.media).context("failed to open fragmented.mp4")?; + let mut media = Source::new(args.media).context("failed to open fragmented.mp4")?; let mut broadcasts = HashMap::new(); broadcasts.insert("demo".to_string(), media.broadcast()); // Create a server to actually serve the media - let config = app::ServerConfig { + let config = ServerConfig { addr: args.addr, cert: args.cert, key: args.key, broadcasts: Arc::new(broadcasts), }; - let mut server = app::Server::new(config).context("failed to create server")?; + let mut server = Server::new(config).context("failed to create server")?; // Run all of the above tokio::select! { diff --git a/moq-warp/src/app/server.rs b/moq-demo/src/server.rs similarity index 93% rename from moq-warp/src/app/server.rs rename to moq-demo/src/server.rs index 25fda11..1dcd740 100644 --- a/moq-warp/src/app/server.rs +++ b/moq-demo/src/server.rs @@ -1,19 +1,20 @@ use super::session::Session; -use crate::media; + +use moq_transport::server::Endpoint; +use moq_warp::Broadcasts; use std::{fs, io, net, path, sync, time}; use anyhow::Context; -use moq_transport::server; use tokio::task::JoinSet; pub struct Server { // The MoQ transport server. - server: server::Endpoint, + server: Endpoint, // The media source. - broadcasts: media::Broadcasts, + broadcasts: Broadcasts, // Sessions actively being run. sessions: JoinSet>, @@ -24,7 +25,7 @@ pub struct ServerConfig { pub cert: path::PathBuf, pub key: path::PathBuf, - pub broadcasts: media::Broadcasts, + pub broadcasts: Broadcasts, } impl Server { @@ -76,7 +77,7 @@ impl Server { let server = quinn::Endpoint::server(server_config, config.addr)?; let broadcasts = config.broadcasts; - let server = server::Endpoint::new(server); + let server = Endpoint::new(server); let sessions = JoinSet::new(); Ok(Self { diff --git a/moq-warp/src/app/session.rs b/moq-demo/src/session.rs similarity index 95% rename from moq-warp/src/app/session.rs rename to moq-demo/src/session.rs index e184fcf..e726cbb 100644 --- a/moq-warp/src/app/session.rs +++ b/moq-demo/src/session.rs @@ -1,5 +1,3 @@ -use crate::media; - use anyhow::Context; use tokio::io::AsyncWriteExt; @@ -9,6 +7,7 @@ use std::sync::Arc; use moq_transport::coding::VarInt; use moq_transport::{control, data, server, setup}; +use moq_warp::{Broadcasts, Segment, Track}; pub struct Session { // Used to send/receive data streams. @@ -18,14 +17,14 @@ pub struct Session { control: control::Stream, // The list of available broadcasts for the session. - media: media::Broadcasts, + media: Broadcasts, // The list of active subscriptions. tasks: JoinSet>, } impl Session { - pub async fn accept(session: server::Accept, media: media::Broadcasts) -> anyhow::Result { + pub async fn accept(session: server::Accept, media: Broadcasts) -> anyhow::Result { // Accep the WebTransport session. // OPTIONAL validate the conn.uri() otherwise call conn.reject() let session = session @@ -162,7 +161,7 @@ impl Session { pub struct Subscription { transport: Arc, track_id: VarInt, - track: media::Track, + track: Track, } impl Subscription { @@ -201,12 +200,12 @@ impl Subscription { struct Group { transport: Arc, track_id: VarInt, - segment: media::Segment, + segment: Segment, } impl Group { pub async fn serve(mut self) -> anyhow::Result<()> { - let header = moq_transport::data::Header { + let header = data::Header { track_id: self.track_id, group_sequence: self.segment.sequence, object_sequence: VarInt::from_u32(0), // Always zero since we send an entire group as an object diff --git a/moq-warp/Cargo.lock b/moq-transport/Cargo.lock similarity index 98% rename from moq-warp/Cargo.lock rename to moq-transport/Cargo.lock index 93b90f0..b72fead 100644 --- a/moq-warp/Cargo.lock +++ b/moq-transport/Cargo.lock @@ -66,6 +66,17 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "async-trait" +version = "0.1.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" @@ -416,7 +427,7 @@ dependencies = [ [[package]] name = "h3" version = "0.0.2" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#db5c723f653911a476bfd8ffcfebf0f8f2eb980d" +source = "git+https://github.com/hyperium/h3?branch=master#3ef7c1a37b635e8446322d8f8d3a68580a208ad8" dependencies = [ "bytes", "fastrand", @@ -429,8 +440,8 @@ dependencies = [ [[package]] name = "h3-quinn" -version = "0.0.2" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#db5c723f653911a476bfd8ffcfebf0f8f2eb980d" +version = "0.0.3" +source = "git+https://github.com/hyperium/h3?branch=master#3ef7c1a37b635e8446322d8f8d3a68580a208ad8" dependencies = [ "bytes", "futures", @@ -444,7 +455,7 @@ dependencies = [ [[package]] name = "h3-webtransport" version = "0.1.0" -source = "git+https://github.com/security-union/h3?branch=add-webtransport#db5c723f653911a476bfd8ffcfebf0f8f2eb980d" +source = "git+https://github.com/hyperium/h3?branch=master#3ef7c1a37b635e8446322d8f8d3a68580a208ad8" dependencies = [ "bytes", "futures-util", @@ -723,6 +734,7 @@ name = "moq" version = "0.1.0" dependencies = [ "anyhow", + "async-trait", "bytes", "clap", "env_logger", diff --git a/moq-transport/Cargo.toml b/moq-transport/Cargo.toml index b5d3353..881ba8e 100644 --- a/moq-transport/Cargo.toml +++ b/moq-transport/Cargo.toml @@ -1,37 +1,31 @@ [package] name = "moq-transport" +description = "Media over QUIC" +authors = [ "Luke Curley" ] +repository = "https://github.com/kixelated/moq-rs" +license = "Apache-2.0" + version = "0.1.0" edition = "2021" +keywords = [ "quic", "http3", "webtransport", "media", "live" ] +categories = [ "multimedia", "network-programming", "web-programming" ] + + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# Fork of h3 with WebTransport support -h3 = { git = "https://github.com/security-union/h3", branch = "add-webtransport" } -h3-quinn = { git = "https://github.com/security-union/h3", branch = "add-webtransport" } -h3-webtransport = { git = "https://github.com/security-union/h3", branch = "add-webtransport" } -quinn = { version = "0.10", default-features = false, features = ["runtime-tokio", "tls-rustls", "ring"] } -quinn-proto = "0.10" +# WebTransport support: TODO pin a version when released +h3 = { git = "https://github.com/hyperium/h3", branch = "master" } +h3-quinn = { git = "https://github.com/hyperium/h3", branch = "master" } +h3-webtransport = { git = "https://github.com/hyperium/h3", branch = "master" } +quinn = "0.10" http = "0.2" -# Crypto dependencies -ring = "0.16" -rustls = { version = "0.21", features = ["dangerous_configuration"] } -rustls-pemfile = "1.0.2" - -# Async stuff -tokio = { version = "1.27", features = ["full"] } -futures = "0.3" - -# Encoding +tokio = { version = "1.27", features = ["macros"] } bytes = "1" -# Logging -clap = { version = "4.0", features = [ "derive" ] } -log = { version = "0.4", features = ["std"] } -env_logger = "0.9.3" - -# Utility +log = "0.4" anyhow = "1.0.70" thiserror = "1.0.21" async-trait = "0.1" diff --git a/moq-transport/src/coding/duration.rs b/moq-transport/src/coding/duration.rs index a2a48c5..7d0ab37 100644 --- a/moq-transport/src/coding/duration.rs +++ b/moq-transport/src/coding/duration.rs @@ -1,6 +1,5 @@ -use super::{Decode, Encode}; +use crate::coding::{Decode, Encode, VarInt}; -use crate::coding::VarInt; use async_trait::async_trait; use tokio::io::{AsyncRead, AsyncWrite}; diff --git a/moq-transport/src/coding/varint.rs b/moq-transport/src/coding/varint.rs index 7748694..c275cc4 100644 --- a/moq-transport/src/coding/varint.rs +++ b/moq-transport/src/coding/varint.rs @@ -5,7 +5,7 @@ use std::convert::{TryFrom, TryInto}; use std::fmt; -use super::{Decode, Encode}; +use crate::coding::{Decode, Encode}; use thiserror::Error; diff --git a/moq-transport/src/lib.rs b/moq-transport/src/lib.rs index 7a4785f..5519519 100644 --- a/moq-transport/src/lib.rs +++ b/moq-transport/src/lib.rs @@ -3,3 +3,5 @@ pub mod control; pub mod data; pub mod server; pub mod setup; + +pub use coding::VarInt; diff --git a/moq-warp/Cargo.toml b/moq-warp/Cargo.toml index bc53dcc..906218a 100644 --- a/moq-warp/Cargo.toml +++ b/moq-warp/Cargo.toml @@ -1,48 +1,22 @@ [package] name = "moq-warp" +description = "Media over QUIC" +authors = [ "Luke Curley" ] +repository = "https://github.com/kixelated/moq-rs" +license = "Apache-2.0" + version = "0.1.0" edition = "2021" +keywords = [ "quic", "http3", "webtransport", "media", "live" ] +categories = [ "multimedia", "network-programming", "web-programming" ] + + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# WebTransport support: TODO pin a version when released -h3 = { git = "https://github.com/hyperium/h3", branch = "master" } -h3-quinn = { git = "https://github.com/hyperium/h3", branch = "master" } -h3-webtransport = { git = "https://github.com/hyperium/h3", branch = "master" } -quinn = { version = "0.10", default-features = false, features = ["runtime-tokio", "tls-rustls", "ring"] } -quinn-proto = "0.10" - -# Crypto dependencies -ring = "0.16" -rustls = { version = "0.21", features = ["dangerous_configuration"] } -rustls-pemfile = "1.0.2" - -# Async stuff -tokio = { version = "1.27", features = ["full"] } -futures = "0.3" - -# Media -mp4 = "0.13.0" - -# Encoding -bytes = "1" -serde = "1.0.160" -serde_json = "1.0" - -# Web server to serve the fingerprint -http = "0.2" -warp = { version = "0.3.3", features = ["tls"] } -hex = "0.4.3" - -# Logging -clap = { version = "4.0", features = [ "derive" ] } -log = { version = "0.4", features = ["std"] } -env_logger = "0.9.3" - -# Utility -anyhow = "1.0.70" -thiserror = "1.0.21" -paste = "1.0" - moq-transport = { path = "../moq-transport" } + +tokio = "1.27" +mp4 = "0.13.0" +anyhow = "1.0.70" diff --git a/moq-warp/src/app/mod.rs b/moq-warp/src/app/mod.rs deleted file mode 100644 index 9efc4ca..0000000 --- a/moq-warp/src/app/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod server; -mod session; - -pub use server::*; -pub use session::*; diff --git a/moq-warp/src/lib.rs b/moq-warp/src/lib.rs index 3dccb66..923cde4 100644 --- a/moq-warp/src/lib.rs +++ b/moq-warp/src/lib.rs @@ -1,2 +1,8 @@ -pub mod app; -pub mod media; +mod source; +pub use source::Source; + +mod model; +pub use model::*; + +mod watch; +use watch::{Producer, Subscriber}; diff --git a/moq-warp/src/media/mod.rs b/moq-warp/src/media/mod.rs deleted file mode 100644 index 923cde4..0000000 --- a/moq-warp/src/media/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -mod source; -pub use source::Source; - -mod model; -pub use model::*; - -mod watch; -use watch::{Producer, Subscriber}; diff --git a/moq-warp/src/media/model.rs b/moq-warp/src/model.rs similarity index 96% rename from moq-warp/src/media/model.rs rename to moq-warp/src/model.rs index 54d924c..7734403 100644 --- a/moq-warp/src/media/model.rs +++ b/moq-warp/src/model.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use std::sync::Arc; use std::time::Instant; -use moq_transport::coding::VarInt; +use moq_transport::VarInt; // Map from track namespace to broadcast. // TODO support updates diff --git a/moq-warp/src/media/source.rs b/moq-warp/src/source.rs similarity index 99% rename from moq-warp/src/media/source.rs rename to moq-warp/src/source.rs index 76e3b63..6dc87db 100644 --- a/moq-warp/src/media/source.rs +++ b/moq-warp/src/source.rs @@ -2,16 +2,13 @@ use std::io::Read; use std::{fs, io, path, time}; -use anyhow; - -use mp4; use mp4::ReadBox; use anyhow::Context; use std::collections::HashMap; use std::sync::Arc; -use moq_transport::coding::VarInt; +use moq_transport::VarInt; use super::{Broadcast, Fragment, Producer, Segment, Track}; diff --git a/moq-warp/src/media/watch.rs b/moq-warp/src/watch.rs similarity index 100% rename from moq-warp/src/media/watch.rs rename to moq-warp/src/watch.rs