Skip to content
File

Blob: archive/str0m-probe/src/lib.rs

rust29 lines
1//! Isolated feasibility probe; not part of the maintained firmware.
2#![forbid(unsafe_code)]
3 
4pub mod driver;
5 
6use std::{sync::Arc, time::Instant};
7use str0m::{Rtc, channel::ChannelConfig, channel::Reliability, crypto::dtls::DtlsCert};
8 
9pub fn rtc(certificate: DtlsCert) -> Rtc {
10 Rtc::builder()
11 .set_crypto_provider(Arc::new(str0m_rust_crypto::default_provider()))
12 .set_dtls_cert(certificate)
13 .build(Instant::now())
14}
15 
16pub fn channel(label: &str, id: u16, reliable: bool) -> ChannelConfig {
17 ChannelConfig {
18 label: label.to_owned(),
19 negotiated: Some(id),
20 ordered: reliable,
21 reliability: if reliable {
22 Reliability::Reliable
23 } else {
24 Reliability::MaxRetransmits { retransmits: 0 }
25 },
26 ..Default::default()
27 }
28}