Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace webtransport-generic with web-transport #151

Merged
merged 5 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 60 additions & 65 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions moq-clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ moq-transport = { path = "../moq-transport", version = "0.3" }

# QUIC
quinn = "0.10"
webtransport-quinn = { version = "0.9" }
webtransport-generic = { version = "0.9" }
quictransport-quinn = { version = "0.9" }
web-transport-quinn = "0.1"
url = "2"

# Crypto
Expand Down
32 changes: 18 additions & 14 deletions moq-clock/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,17 @@ async fn main() -> anyhow::Result<()> {

log::info!("connecting to server: url={}", config.url);

match config.url.scheme() {
let session = match config.url.scheme() {
"https" => {
tls_config.alpn_protocols = vec![webtransport_quinn::ALPN.to_vec()]; // this one is important
tls_config.alpn_protocols = vec![web_transport_quinn::ALPN.to_vec()]; // this one is important
let client_config = quinn::ClientConfig::new(Arc::new(tls_config));

let mut endpoint = quinn::Endpoint::client(config.bind)?;
endpoint.set_default_client_config(client_config);

let session = webtransport_quinn::connect(&endpoint, &config.url)
web_transport_quinn::connect(&endpoint, &config.url)
.await
.context("failed to create WebTransport session")?;

run(session, config).await
.context("failed to create WebTransport session")?
}
"moqt" => {
tls_config.alpn_protocols = vec![moq_transport::setup::ALPN.to_vec()]; // this one is important
Expand All @@ -80,19 +78,25 @@ async fn main() -> anyhow::Result<()> {
let mut endpoint = quinn::Endpoint::client(config.bind)?;
endpoint.set_default_client_config(client_config);

let session = quictransport_quinn::connect(&endpoint, &config.url)
let host = config.url.host().context("invalid DNS name")?.to_string();
let port = config.url.port().unwrap_or(443);

// Look up the DNS entry.
let remote = tokio::net::lookup_host((host.clone(), port))
.await
.context("failed to create QUIC Transport session")?;
.context("failed DNS lookup")?
.next()
.context("no DNS entries")?;

run(session, config).await
// Connect to the server using the addr we just resolved.
let conn = endpoint.connect(remote, &host)?.await?;
conn.into()
}
_ => anyhow::bail!("unsupported scheme: {}", config.url.scheme()),
}
}
};

async fn run<S: webtransport_generic::Session>(session: S, config: cli::Config) -> anyhow::Result<()> {
if config.publish {
let (session, mut publisher) = moq_transport::Publisher::connect(session)
let (session, mut publisher) = moq_transport::Publisher::connect(session.into())
.await
.context("failed to create MoQ Transport session")?;

Expand All @@ -110,7 +114,7 @@ async fn run<S: webtransport_generic::Session>(session: S, config: cli::Config)
res = publisher.serve(broadcast_sub) => res.context("failed to serve broadcast")?,
}
} else {
let (session, mut subscriber) = moq_transport::Subscriber::connect(session)
let (session, mut subscriber) = moq_transport::Subscriber::connect(session.into())
.await
.context("failed to create MoQ Transport session")?;

Expand Down
4 changes: 1 addition & 3 deletions moq-pub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ moq-transport = { path = "../moq-transport", version = "0.3" }

# QUIC
quinn = "0.10"
webtransport-quinn = { version = "0.9" }
quictransport-quinn = { version = "0.9" }
webtransport-generic = { version = "0.9" }
web-transport-quinn = "0.1"
url = "2"

# Crypto
Expand Down
Loading
Loading