Fix a panic when --fingerprint was not provided, and rename it to --dev (#96)
This commit is contained in:
parent
9a25143694
commit
d0fca05485
|
@ -31,7 +31,7 @@ Notable arguments:
|
||||||
- `--listen <ADDR>` Listen on this address, default: `[::]:4443`
|
- `--listen <ADDR>` Listen on this address, default: `[::]:4443`
|
||||||
- `--cert <CERT>` Use the certificate file at this path
|
- `--cert <CERT>` Use the certificate file at this path
|
||||||
- `--key <KEY>` Use the private key at this path
|
- `--key <KEY>` Use the private key at this path
|
||||||
- `--fingerprint` Listen via HTTPS as well, serving the `/fingerprint` of the self-signed certificate. (dev only)
|
- `--dev` Listen via HTTPS as well, serving the `/fingerprint` of the self-signed certificate. (dev only)
|
||||||
|
|
||||||
This listens for WebTransport connections on `UDP https://localhost:4443` by default.
|
This listens for WebTransport connections on `UDP https://localhost:4443` by default.
|
||||||
You need a client to connect to that address, to both publish and consume media.
|
You need a client to connect to that address, to both publish and consume media.
|
||||||
|
|
|
@ -34,4 +34,4 @@ fi
|
||||||
echo "Publish URL: https://quic.video/publish/?server=localhost:${PORT}"
|
echo "Publish URL: https://quic.video/publish/?server=localhost:${PORT}"
|
||||||
|
|
||||||
# Run the relay and forward any arguments
|
# Run the relay and forward any arguments
|
||||||
cargo run --bin moq-relay -- --listen "$LISTEN" --cert "$CERT" --key "$KEY" --fingerprint $ARGS -- "$@"
|
cargo run --bin moq-relay -- --listen "$LISTEN" --cert "$CERT" --key "$KEY" --dev $ARGS -- "$@"
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub struct Config {
|
||||||
|
|
||||||
/// Listen on HTTPS and serve /fingerprint, for self-signed certificates
|
/// Listen on HTTPS and serve /fingerprint, for self-signed certificates
|
||||||
#[arg(long, action)]
|
#[arg(long, action)]
|
||||||
pub fingerprint: bool,
|
pub dev: bool,
|
||||||
|
|
||||||
/// Optional: Use the moq-api via HTTP to store origin information.
|
/// Optional: Use the moq-api via HTTP to store origin information.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
|
|
|
@ -35,13 +35,17 @@ async fn main() -> anyhow::Result<()> {
|
||||||
.await
|
.await
|
||||||
.context("failed to create server")?;
|
.context("failed to create server")?;
|
||||||
|
|
||||||
// Create the web server if the --fingerprint flag was set.
|
// Create the web server if the --dev flag was set.
|
||||||
// This is currently only useful in local development so it's not enabled by default.
|
// This is currently only useful in local development so it's not enabled by default.
|
||||||
let web = config.fingerprint.then(|| Web::new(config, tls));
|
if config.dev {
|
||||||
|
let web = Web::new(config, tls);
|
||||||
|
|
||||||
// Run all of the above
|
// Unfortunately we can't use preconditions because Tokio still executes the branch; just ignore the result
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
res = quic.serve() => res.context("failed to run server"),
|
res = quic.serve() => res.context("failed to run quic server"),
|
||||||
res = web.unwrap().serve(), if web.is_some() => res.context("failed to run HTTP server"),
|
res = web.serve() => res.context("failed to run web server"),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quic.serve().await.context("failed to run quic server")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue