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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pkcs8 = "0.11.0"
pollster = "1.0"
# default-features off to skip the fork and timeout machinery; crates opt into what they use.
proptest = { version = "1.12.0", default-features = false, features = ["std"] }
qlog = "0.18"
qmux = { version = "0.7.0", path = "rs/qmux", default-features = false }
rand = "0.10.1"
rand_pcg = "0.10"
Expand Down
20 changes: 1 addition & 19 deletions cpp/moq/cmake/moq-ffi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# (MOQ_FFI_DIR), or a cargo build of this checkout. Sets MOQ_FFI_LIB (the staticlib to link),
# MOQ_FFI_METADATA (the cdylib uniffi-bindgen-cpp reads), MOQ_FFI_CARGO (the target that builds
# them, or empty for a prebuilt input), and MOQ_NATIVE_LIBS (what an external linker adds).
# MOQ_FFI_QLOG adds moq-ffi's qlog feature to the cargo build, which a prebuilt input lacks.
#
# Run with -P, it is that cargo build: it links the libraries cargo reports into OUT, so no
# cargo setting (target-dir, build.target) can move them from where the packages look.
Expand All @@ -21,12 +20,6 @@ if(CMAKE_SCRIPT_MODE_FILE)
if(RELEASE)
list(APPEND _args --release)
endif()
# A cdylib's file name carries no feature hash, so a qlog build takes a target directory of
# its own rather than replacing the default library every other binding loads.
if(QLOG)
string(APPEND _target_dir "/qlog")
list(APPEND _args --features qlog --target-dir "${_target_dir}")
endif()
execute_process(
COMMAND cargo ${_args}
WORKING_DIRECTORY "${WORKSPACE}"
Expand Down Expand Up @@ -119,12 +112,7 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()

set(MOQ_FFI_DIR "" CACHE PATH "Extracted default-feature moq-ffi native package")
option(MOQ_FFI_QLOG "Build moq-ffi from source with qlog trace capture" OFF)
if(MOQ_FFI_DIR)
if(MOQ_FFI_QLOG)
message(FATAL_ERROR "MOQ_FFI_QLOG requires a source build of moq-ffi; MOQ_FFI_DIR "
"carries default features only")
endif()
get_filename_component(MOQ_FFI_DIR "${MOQ_FFI_DIR}" ABSOLUTE)
file(READ "${MOQ_FFI_DIR}/manifest.json" _manifest)
foreach(_field version target features profile source)
Expand Down Expand Up @@ -163,13 +151,8 @@ else()
"or architecture, set MOQ_FFI_DIR to a native package for it")
endif()
# The top-level build tree, so a project adding both packages shares one cargo build and
# one rule for its outputs, as Ninja requires. A qlog build links into a directory of its
# own: the hard link keeps cargo's timestamp, so toggling MOQ_FFI_QLOG in place could swap
# in an older library that nothing relinks against, while a new path changes the commands.
# one rule for its outputs, as Ninja requires.
set(_out "${CMAKE_BINARY_DIR}/moq-ffi")
if(MOQ_FFI_QLOG)
string(APPEND _out "-qlog")
endif()
set(MOQ_FFI_LIB "${_out}/${_moq_ffi_static}")
set(MOQ_FFI_METADATA "${_out}/${_moq_ffi_dynamic}")
set(MOQ_FFI_CARGO moq_ffi_cargo)
Expand All @@ -183,7 +166,6 @@ else()
add_custom_target(moq_ffi_cargo
COMMAND "${CMAKE_COMMAND}" -DWORKSPACE=${_moq_workspace} -DOUT=${_out}
-DSTATIC=${_moq_ffi_static} -DDYNAMIC=${_moq_ffi_dynamic} -DRELEASE=${_release}
-DQLOG=${MOQ_FFI_QLOG}
-P "${CMAKE_CURRENT_LIST_FILE}"
BYPRODUCTS "${MOQ_FFI_LIB}" "${MOQ_FFI_METADATA}"
COMMENT "Building moq-ffi"
Expand Down
8 changes: 0 additions & 8 deletions cpp/obs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ if(MOQ_LOCAL AND EXISTS "${MOQ_LOCAL}/cpp/moq/CMakeLists.txt")
set(_moq_local_build TRUE)
endif()

# Off by default, like moq-ffi's feature. The release archive and a prebuilt MOQ_FFI_DIR carry
# default features only, so refuse here, before the OBS dependencies download, rather than
# silently building without it.
option(MOQ_FFI_QLOG "Build moq-ffi with qlog, which shows the qlog directory setting" OFF)
if(MOQ_FFI_QLOG AND (NOT _moq_local_build OR MOQ_FFI_DIR))
message(FATAL_ERROR "MOQ_FFI_QLOG requires the in-tree build: set MOQ_LOCAL and clear MOQ_FFI_DIR")
endif()

if(_moq_local_build)
file(STRINGS "${MOQ_LOCAL}/cpp/moq/VERSION" _moq_link_version LIMIT_COUNT 1)
if(NOT _moq_link_version MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
Expand Down
4 changes: 1 addition & 3 deletions cpp/obs/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ compile:
../../sh/obs/compile.sh

# Compile and link the plugin the way CI does, against the `.#obs` shell's own
# libobs/Qt6/ffmpeg, then run the unit tests and check that MOQ_FFI_QLOG builds
# moq-ffi with qlog. Linux-only in practice: it's the one platform where nixpkgs
# libobs/Qt6/ffmpeg, then run the unit tests. Linux-only in practice: it's the one platform where nixpkgs
# has obs-studio. The Debug build type reuses the dev-profile Rust artifacts CI
# restores, where a release moq-ffi would rebuild its whole dependency tree.
ci preset="":
cmake --preset "$(../../sh/obs/preset.sh '{{ preset }}' ci)" -DCMAKE_BUILD_TYPE=Debug
cmake --build --preset "$(../../sh/obs/preset.sh '{{ preset }}' ci)"
../../sh/obs/unit.sh
../../sh/obs/qlog.sh

# Unit-test the plugin sources against stubbed libobs and ffmpeg and the real
# moq-ffi, under ThreadSanitizer. Nightly runs it; `just obs ci` runs them
Expand Down
21 changes: 5 additions & 16 deletions cpp/obs/src/moq-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,9 @@ const std::vector<Field> &Fields()
f.push_back(Choose(QUIC_MTU_DISCOVERY, "Path MTU discovery", AutoOnOff(), false,
"Probe the path so packets use the largest size it allows. Turn it "
"off if discovery itself causes drops."));
// Only when this build can capture: setting a directory without support fails
// the dial, so offering it would be a control that only breaks things.
if (moq::qlog_supported()) {
f.push_back(Directory(QUIC_QLOG, "qlog directory",
"Write QUIC connection traces here for diagnosing stalls. Leave "
"empty to disable; the files get large."));
}
f.push_back(Directory(QUIC_QLOG, "qlog directory",
"Write QUIC connection traces here for diagnosing stalls. Leave "
"empty to disable; the files get large."));
f.push_back(Toggle(QUIC_KEYLOG, "TLS key log", false,
"Write TLS session secrets to the file the SSLKEYLOGFILE environment "
"variable names, to decrypt a packet capture. Anyone holding that file "
Expand Down Expand Up @@ -361,15 +357,8 @@ std::string Configure(obs_data_t *settings, moq::ClientConfig &config)
config.quic.keep_alive = Milliseconds(settings, QUIC_KEEP_ALIVE, error);
config.quic.gso = TriState(settings, QUIC_GSO, error);
config.quic.mtu_discovery = TriState(settings, QUIC_MTU_DISCOVERY, error);
// A scene collection written by a qlog-capable build keeps the key even where the
// field is hidden. Refusing would block Go Live on a setting the user can no longer
// see, let alone clear, so the trace is skipped and the log says why.
if (const char *qlog = OptionalString(settings, QUIC_QLOG)) {
if (moq::qlog_supported())
config.quic.qlog = qlog;
else
LOG_WARNING("Skipping the qlog directory %s: this build cannot write qlog", qlog);
}
if (const char *qlog = OptionalString(settings, QUIC_QLOG))
config.quic.qlog = qlog;
config.quic.keylog = obs_data_get_bool(settings, QUIC_KEYLOG);

config.websocket.enabled = obs_data_get_bool(settings, WEBSOCKET_ENABLED);
Expand Down
5 changes: 1 addition & 4 deletions dart/moq/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ final class QuicConfig {
/// The congestion control family; null leaves the choice to the backend.
final CongestionControl? congestionControl;

/// Directory to write qlog traces into; fails unless [qlogSupported].
/// Directory, which must exist, to write qlog traces into.
final String? qlog;

/// Danger: write TLS session secrets to the file `SSLKEYLOGFILE` names, for
Expand Down Expand Up @@ -182,9 +182,6 @@ final class WebSocketConfig {
/// way [ConnectOptions.versions] takes them.
List<String> versions() => moqVersions();

/// Whether this build can write qlog traces for [QuicConfig.qlog].
bool qlogSupported() => moqQlogSupported();

/// A MoQ session with publishing and subscription conveniences.
final class Moq {
final Client _client;
Expand Down
19 changes: 0 additions & 19 deletions dart/moq_ffi/lib/src/moq.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20316,14 +20316,6 @@ MoqClientConfig moqClientDefaults() {
);
}

bool moqQlogSupported() {
return rustCallWithLifter(
(status) => uniffi_moq_ffi_fn_func_moq_qlog_supported(status),
FfiConverterBool.lift,
null,
);
}

List<String> moqVersions() {
return rustCallWithLifter(
(status) => uniffi_moq_ffi_fn_func_moq_versions(status),
Expand Down Expand Up @@ -23780,11 +23772,6 @@ external RustBuffer uniffi_moq_ffi_fn_func_moq_client_defaults(
Pointer<RustCallStatus> uniffiStatus,
);

@Native<Int8 Function(Pointer<RustCallStatus>)>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_fn_func_moq_qlog_supported(
Pointer<RustCallStatus> uniffiStatus,
);

@Native<RustBuffer Function(Pointer<RustCallStatus>)>(assetId: _uniffiAssetId)
external RustBuffer uniffi_moq_ffi_fn_func_moq_versions(
Pointer<RustCallStatus> uniffiStatus,
Expand Down Expand Up @@ -24131,9 +24118,6 @@ external int uniffi_moq_ffi_checksum_func_moq_log_level();
@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_func_moq_client_defaults();

@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_func_moq_qlog_supported();

@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_func_moq_versions();

Expand Down Expand Up @@ -25028,9 +25012,6 @@ void _checkApiChecksums() {
if (uniffi_moq_ffi_checksum_func_moq_client_defaults() != 15294) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_func_moq_qlog_supported() != 58291) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_func_moq_versions() != 28954) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
Expand Down
11 changes: 2 additions & 9 deletions doc/bin/obs.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,14 @@ Xcode or Visual Studio 2022, plus Rust and
[`uniffi-bindgen-cpp`](/lib/cpp/) to build the C++ package in-tree; see
[`cpp/obs/`](https://github.com/moq-dev/moq/tree/main/cpp/obs).

To capture qlog traces, configure a source build with `-DMOQ_FFI_QLOG=ON`, for
example `cmake --preset ubuntu-x86_64 -DMOQ_FFI_QLOG=ON` before `just obs build`.
It builds moq-ffi with its `qlog` feature, which adds a qlog directory to the
advanced settings. It is off by default, and the prebuilt archives leave it
out, so configuration fails if the C++ package would come from a release
archive or `MOQ_FFI_DIR`.

## Advanced settings

Off by default; the defaults suit a normal relay. They cover what you would
otherwise pass to `moq` on the command line: pinning a protocol version, the
local bind address and connect timing, trusting a self-signed relay or private
CA, reconnect pacing, QUIC tuning (congestion control, idle timeout,
keep-alive, segmentation offload, MTU discovery, and qlog traces when the build
supports them), and the WebSocket fallback race. A keep-alive interval of 0
keep-alive, segmentation offload, MTU discovery, and qlog traces), and the
WebSocket fallback race. A keep-alive interval of 0
uses the negotiated idle timeout to choose how often to ping. A rejected value stops the
stream with the reason in the log rather than silently using a default.
To decrypt a packet capture, turn on **TLS key log** here or in a MoQ Source's
Expand Down
2 changes: 1 addition & 1 deletion doc/bin/relay/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mtu_discovery = false # Path MTU discovery. Default.
receive_window = 4194304 # Whole-connection window, in bytes. Default (4 MiB).
stream_receive_window = 1048576 # Per-stream window, in bytes. Default (1 MiB).
send_window = 4194304 # Unacknowledged outgoing data, in bytes. Default (4 MiB).
qlog = "/var/log/moq/qlog" # Existing directory. Needs the `qlog` build feature.
qlog = "/var/log/moq/qlog" # Existing directory.
# keylog = "/private/keys.log" # Explicit secret log path; unset is off.
```

Expand Down
5 changes: 1 addition & 4 deletions doc/lib/cpp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ metadata library and links its static library without compiling Rust. Without
an explicit directory, a release pin in `cpp/moq/FFI_VERSION` selects the default
input; `just cpp package` fetches it with the checked-in SHA-256 hashes and fails
if it cannot verify it. Direct CMake builds and `just cpp check` build the
current checkout unless given an explicit native directory. A source build
with `-DMOQ_FFI_QLOG=ON` adds moq-ffi's `qlog` feature, so
`moq::qlog_supported()` reports true and `QuicConfig::qlog` writes traces; it builds
in its own cargo target directory, and a prebuilt input refuses it. The package is
current checkout unless given an explicit native directory. The package is
`moq-cpp`. It and the C package, `moq-c`, each link in their own copy of the
Rust core, so a program links one of the two, never both.

Expand Down
3 changes: 1 addition & 2 deletions go/wrapper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ type QUICConfig struct {
MTUDiscovery *bool
// CongestionControl picks the congestion control family; nil leaves the choice to the backend.
CongestionControl *CongestionControl
// Qlog is a directory, which must exist, to write qlog traces into. Dial
// fails unless QlogSupported.
// Qlog is a directory, which must exist, to write qlog traces into.
Qlog string
// Keylog writes TLS session secrets to the file SSLKEYLOGFILE names, for
// decrypting a capture. Without SSLKEYLOGFILE the dial fails.
Expand Down
5 changes: 0 additions & 5 deletions go/wrapper/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ func Versions() []string {
return ffi.MoqVersions()
}

// QlogSupported reports whether this build can write qlog traces for QUICConfig.Qlog.
func QlogSupported() bool {
return ffi.MoqQlogSupported()
}

// LogLevel configures the native tracing log level (e.g. "info", "debug").
func LogLevel(level string) error {
return ffi.MoqLogLevel(level)
Expand Down
3 changes: 0 additions & 3 deletions kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ package dev.moq
*/
fun versions(): List<String> = uniffi.moq.moqVersions()

/** Whether this build can write qlog traces for [QuicConfig.qlog]. */
fun qlogSupported(): Boolean = uniffi.moq.moqQlogSupported()

/**
* The caller's product tokens, if any, then this package's, which moq-ffi advertises ahead of its
* own.
Expand Down
16 changes: 0 additions & 16 deletions nix/Cargo.nix

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

2 changes: 1 addition & 1 deletion py/moq-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ client = moq.Client(
- `fingerprints`. Hex SHA-256 fingerprint(s) to pin the peer's certificate to, the native equivalent of `serverCertificateHashes`. Accepts the values a server reports via `cert_fingerprints()`, so you can trust a self-signed certificate without `insecure=True`.
- `cert`, `key`. Paired PEM certificate chain and private key paths for mTLS.
- `host_name`. Verify the certificate against this name (SNI) instead of the URL's host.
- `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`, such as `CongestionControl.delay()`), and `qlog` (a trace directory when `qlog_supported()`). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build.
- `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`, such as `CongestionControl.delay()`), and `qlog` (a trace directory, which must exist). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build.
- `websocket=WebSocketConfig(...)`. The fallback raced against QUIC: `enabled=False` turns it off, and `delay` is QUIC's head start.
- `once`, `backoff`. Redial with a `Backoff` when the transport drops; `once=True` dials once.
- `.session`. The connecting or connected `Session` (or `None` before entering / after exit).
Expand Down
Loading