openrtc 2.8.3

OpenRTC: a Rust-first P2P runtime for device discovery, signaling, and iroh/QUIC networking.
Documentation
//! Private carrier identities used below the Iroh endpoint.

/// Experimental IDs are intentionally not advertised as public interoperability
/// identifiers until Iroh's transport registry assigns stable values.
pub const EXPERIMENTAL_WEBRTC_TRANSPORT_ID: u64 = 0x4f_52_54_57;
pub const EXPERIMENTAL_MOQ_TRANSPORT_ID: u64 = 0x4f_52_4d_51;

/// Returns whether `transport_id` belongs to an OpenRTC-owned custom carrier.
///
/// Accept loops use this narrow allowlist to distinguish a carrier candidate,
/// whose coordination authorization may still be in flight, from an ordinary
/// Iroh connection that must continue through normal admission immediately.
#[cfg(any(
    not(target_arch = "wasm32"),
    feature = "transport-webrtc",
    feature = "transport-moq",
    test
))]
pub(crate) fn is_openrtc_carrier_transport_id(transport_id: u64) -> bool {
    matches!(
        transport_id,
        EXPERIMENTAL_WEBRTC_TRANSPORT_ID | EXPERIMENTAL_MOQ_TRANSPORT_ID
    )
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum IrohCarrierKind {
    WebRtc,
    Moq,
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn only_openrtc_carrier_transport_ids_receive_candidate_grace() {
        assert!(is_openrtc_carrier_transport_id(
            EXPERIMENTAL_WEBRTC_TRANSPORT_ID
        ));
        assert!(is_openrtc_carrier_transport_id(
            EXPERIMENTAL_MOQ_TRANSPORT_ID
        ));
        assert!(!is_openrtc_carrier_transport_id(0));
        assert!(!is_openrtc_carrier_transport_id(0x4f_52_54_58));
    }
}