Skip to main content

oxpulse_sfu_kit/
origin.rs

1//! Publisher origin — local client or upstream SFU relay connection.
2
3/// Whether this client represents a direct peer or an upstream SFU relay.
4///
5/// `Local` is the default — a direct WebRTC peer connection. `RelayFromSfu`
6/// is set by the application after ICE/DTLS completes on the edge-to-edge
7/// relay connection; the string is an opaque upstream edge identifier
8/// (typically URL or region ID) used for logging and diagnostics.
9///
10/// # Call order
11///
12/// Call [`Client::set_origin`][crate::Client::set_origin] **before**
13/// [`Registry::insert`][crate::Registry::insert]. The insert path reads
14/// `is_relay()` to decide whether to register the peer with the
15/// dominant-speaker detector.
16#[derive(Debug, Clone, PartialEq, Eq, Default)]
17#[non_exhaustive]
18pub enum ClientOrigin {
19    /// A normal WebRTC peer connected directly to this SFU.
20    #[default]
21    Local,
22    /// A relay connection from another SFU edge.
23    ///
24    /// The string is typically the upstream edge URL or region identifier.
25    /// It has no semantic effect inside the kit.
26    RelayFromSfu(String),
27}