-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
570 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
members = ["moq-transport", "moq-relay", "moq-pub", "moq-api"] | ||
members = ["moq-transport", "moq-relay", "moq-pub", "moq-api", "moq-clock"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# Change directory to the root of the project | ||
cd "$(dirname "$0")/.." | ||
|
||
# Use debug logging by default | ||
export RUST_LOG="${RUST_LOG:-debug}" | ||
|
||
# Connect to localhost by default. | ||
HOST="${HOST:-localhost}" | ||
PORT="${PORT:-4443}" | ||
ADDR="${ADDR:-$HOST:$PORT}" | ||
NAME="${NAME:-clock}" | ||
|
||
# Combine the host and name into a URL. | ||
URL="${URL:-"https://$ADDR/$NAME"}" | ||
|
||
cargo run --bin moq-clock -- "$URL" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[package] | ||
name = "moq-clock" | ||
description = "CLOCK over QUIC" | ||
authors = ["Luke Curley"] | ||
repository = "https://github.com/kixelated/moq-rs" | ||
license = "MIT OR 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" } | ||
|
||
# QUIC | ||
quinn = "0.10" | ||
webtransport-quinn = "0.6" | ||
url = "2" | ||
|
||
# Crypto | ||
rustls = { version = "0.21", features = ["dangerous_configuration"] } | ||
rustls-native-certs = "0.6" | ||
rustls-pemfile = "1" | ||
|
||
# Async stuff | ||
tokio = { version = "1", features = ["full"] } | ||
|
||
# CLI, logging, error handling | ||
clap = { version = "4", features = ["derive"] } | ||
log = { version = "0.4", features = ["std"] } | ||
env_logger = "0.9" | ||
anyhow = { version = "1", features = ["backtrace"] } | ||
tracing = "0.1" | ||
tracing-subscriber = "0.3" | ||
|
||
# CLOCK STUFF | ||
chrono = "0.4" | ||
|
||
[build-dependencies] | ||
clap = { version = "4", features = ["derive"] } | ||
clap_mangen = "0.2" | ||
url = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use clap::Parser; | ||
use std::{net, path}; | ||
use url::Url; | ||
|
||
#[derive(Parser, Clone, Debug)] | ||
pub struct Config { | ||
/// Listen for UDP packets on the given address. | ||
#[arg(long, default_value = "[::]:0")] | ||
pub bind: net::SocketAddr, | ||
|
||
/// Connect to the given URL starting with https:// | ||
#[arg(value_parser = moq_url)] | ||
pub url: Url, | ||
|
||
/// Use the TLS root CA at this path, encoded as PEM. | ||
/// | ||
/// This value can be provided multiple times for multiple roots. | ||
/// If this is empty, system roots will be used instead | ||
#[arg(long)] | ||
pub tls_root: Vec<path::PathBuf>, | ||
|
||
/// Danger: Disable TLS certificate verification. | ||
/// | ||
/// Fine for local development, but should be used in caution in production. | ||
#[arg(long)] | ||
pub tls_disable_verify: bool, | ||
|
||
/// Publish the current time to the relay, otherwise only subscribe. | ||
#[arg(long)] | ||
pub publish: bool, | ||
|
||
/// The name of the clock track. | ||
#[arg(long, default_value = "now")] | ||
pub track: String, | ||
} | ||
|
||
fn moq_url(s: &str) -> Result<Url, String> { | ||
let url = Url::try_from(s).map_err(|e| e.to_string())?; | ||
|
||
// Make sure the scheme is moq | ||
if url.scheme() != "https" { | ||
return Err("url scheme must be https:// for WebTransport".to_string()); | ||
} | ||
|
||
Ok(url) | ||
} |
Oops, something went wrong.