Skip to content
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
2 changes: 1 addition & 1 deletion demo/boy/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gb-run:

# Start a Game Boy emulator publisher.
start rom url='http://localhost:4443':
cargo run --bin moq-boy -- --client-connect "{{ url }}" --rom "{{ rom }}" --location localhost

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good change

cargo run --bin moq-boy -- --connect "{{ url }}" --rom "{{ rom }}" --location localhost

# Host the web server
web url='http://localhost:4443':
Expand Down
6 changes: 3 additions & 3 deletions demo/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod web
# Picks the first free port at/after 4443 (both UDP for QUIC and TCP for HTTP)
# so multiple worktrees can run `just dev` without colliding. The relay reads

# the port from MOQ_SERVER_BIND/MOQ_WEB_HTTP_LISTEN, overriding localhost.toml.
# the port from MOQ_LISTEN/MOQ_WEB_HTTP_LISTEN, overriding localhost.toml.
default:
#!/usr/bin/env bash
set -euo pipefail
Expand All @@ -25,10 +25,10 @@ default:
base="http://localhost:$port"

# Scope the bind env vars to the relay only. The unified `moq` binary also
# reads MOQ_SERVER_BIND, so exporting it globally would make the `pub` client
# reads MOQ_LISTEN, so exporting it globally would make the `pub` client
# try to start a server (and fail without a TLS cert).
bun run concurrently --kill-others --names rly,bbb,web --prefix-colors auto \
"MOQ_SERVER_BIND='[::]:$port' MOQ_WEB_HTTP_LISTEN='[::]:$port' just relay" \
"MOQ_LISTEN='[::]:$port' MOQ_WEB_HTTP_LISTEN='[::]:$port' just relay" \
"just wait $base/certificate.sha256 && just pub bbb $base" \
"just wait $base/certificate.sha256 && just web serve $base"

Expand Down
14 changes: 7 additions & 7 deletions demo/pub/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ tos url='http://localhost:4443' *args:
# Publish a video using ffmpeg (CMAF / fMP4) to a relay server.
cmaf name url='http://localhost:4443' *args:
cargo build --bin moq
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --client-connect "{{ url }}" --broadcast "{{ name }}.hang" import fmp4
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --connect "{{ url }}" --broadcast "{{ name }}.hang" import fmp4

# Publish a video using ffmpeg (MPEG-TS) to a relay server.
ts name url='http://localhost:4443' *args:
cargo build --bin moq
just ffmpeg-ts "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --client-connect "{{ url }}" --broadcast "{{ name }}.hang" import ts
just ffmpeg-ts "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --connect "{{ url }}" --broadcast "{{ name }}.hang" import ts

# Publish a video via iroh.
iroh name url prefix="":
just download "{{ name }}"
cargo build --bin moq
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- --iroh-enabled --client-connect "{{ url }}" --broadcast "{{ prefix }}{{ name }}.hang" import fmp4
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- --iroh-enabled --connect "{{ url }}" --broadcast "{{ prefix }}{{ name }}.hang" import fmp4

# Generate and ingest an HLS stream from a video file.
hls name relay="http://localhost:4443":
Expand Down Expand Up @@ -131,7 +131,7 @@ hls name relay="http://localhost:4443":
trap cleanup SIGINT SIGTERM EXIT

echo ">>> Importing HLS via moq-cli"
cargo run --bin moq -- --client-connect "{{ relay }}" --broadcast "{{ name }}.hang" import hls "$OUT_DIR/master.m3u8"
cargo run --bin moq -- --connect "{{ relay }}" --broadcast "{{ name }}.hang" import hls "$OUT_DIR/master.m3u8"
EXIT_CODE=$?

cleanup
Expand All @@ -148,13 +148,13 @@ h264 name url="http://localhost:4443" *args:
-c:v copy -an \
-bsf:v h264_mp4toannexb \
-f h264 \
- | cargo run --bin moq -- {{ args }} --client-connect "{{ url }}" --broadcast "{{ name }}.hang" import avc3
- | cargo run --bin moq -- {{ args }} --connect "{{ url }}" --broadcast "{{ name }}.hang" import avc3

# Publish a video using ffmpeg directly from moq to the localhost.
serve name *args:
just download "{{ name }}"
cargo build --bin moq
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --server-bind "[::]:4443" --tls-generate "localhost" --broadcast "{{ name }}.hang" import fmp4
just ffmpeg-cmaf "media/{{ name }}.mp4" | cargo run --bin moq -- {{ args }} --listen "[::]:4443" --listen-tls-generate "localhost" --broadcast "{{ name }}.hang" import fmp4

# Generate and serve an HLS stream from a video for testing.
serve-hls name port="8000":
Expand Down Expand Up @@ -205,7 +205,7 @@ clock action url="http://localhost:4443" *args:
exit 1; \
fi

cargo run -p moq-native --example clock -- --client-connect "{{ url }}" --broadcast "clock" {{ args }} {{ action }}
cargo run -p moq-native --example clock -- --connect "{{ url }}" --broadcast "clock" {{ args }} {{ action }}

# --- GStreamer ---

Expand Down
6 changes: 3 additions & 3 deletions demo/relay/leaf0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# The RUST_LOG environment variable will take precedence.
level = "debug"

[server]
[listen]
# Listen for QUIC connections on UDP:4444
# Sometimes IPv6 causes issues; try 127.0.0.1:4444 instead.
listen = "[::]:4444"
bind = "[::]:4444"

# Serve the same cluster-signed certificate that we present as a client,
# so other leaves can verify us against `ca.pem`.
Expand All @@ -19,7 +19,7 @@ tls.key = ["leaf0.key"]
# the JWT path and are rejected.
tls.root = ["ca.pem"]

[client]
[connect]
# Present this certificate and key on outbound cluster connections.
# The root maps a valid cert to full access.
tls.cert = "leaf0.crt"
Expand Down
6 changes: 3 additions & 3 deletions demo/relay/leaf1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# The RUST_LOG environment variable will take precedence.
level = "debug"

[server]
[listen]
# Listen for QUIC connections on UDP:4445
# Sometimes IPv6 causes issues; try 127.0.0.1:4445 instead.
listen = "[::]:4445"
bind = "[::]:4445"

# Serve the same cluster-signed certificate that we present as a client,
# so other leaves can verify us against `ca.pem`.
Expand All @@ -19,7 +19,7 @@ tls.key = ["leaf1.key"]
# the JWT path and are rejected.
tls.root = ["ca.pem"]

[client]
[connect]
# Present this certificate and key on outbound cluster connections.
# The root maps a valid cert to full access.
tls.cert = "leaf1.crt"
Expand Down
4 changes: 2 additions & 2 deletions demo/relay/localhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# The RUST_LOG environment variable will take precedence.
level = "debug"

[server]
[listen]
# Listen for QUIC connections on UDP:4443
# Sometimes IPv6 causes issues; try 127.0.0.1:4443 instead.
listen = "[::]:4443"
bind = "[::]:4443"

# Generate a self-signed certificate for the given hostnames.
# This is used for local development, in conjunction with a fingerprint, or with TLS verification disabled.
Expand Down
6 changes: 3 additions & 3 deletions demo/relay/prod.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# An example of a production configuration.
# Here's a real one: https://github.com/moq-dev/moq.dev/blob/b4da7dd8f09879cefb593d5e35f99f064caa3943/infra/relay.yml.tpl#L56

[server]
[listen]
# Listen for QUIC connections on UDP:443
# This is the default port for WebTransport
listen = "[::]:443"
bind = "[::]:443"

[server.tls]
[listen.tls]
# You'll need to provide a real certificate and key in production.
# You can get this via a service like Let's Encrypt.
cert = "cert.pem"
Expand Down
4 changes: 2 additions & 2 deletions demo/relay/root.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# The RUST_LOG environment variable will take precedence.
level = "debug"

[server]
[listen]
# Listen for QUIC connections on UDP:4443
# Sometimes IPv6 causes issues; try 127.0.0.1:4443 instead.
listen = "[::]:4443"
bind = "[::]:4443"

# Server certificate and key signed by the cluster CA so leaves can
# verify via `tls.root`. `just cert root` generates these files.
Expand Down
Loading
Loading