[relay] Calls: a long-poll on the fetch route, TURN credentials for coturn, wakes every 10 s; the module passes the TURN secret by systemd credential

This commit is contained in:
2026-12-03 00:29:07 +01:00
parent 1e2eed8e5b
commit 776e4ce39b
15 changed files with 654 additions and 22 deletions
+13 -5
View File
@@ -65,11 +65,19 @@ async fn main() {
});
let clock: Clock = Arc::new(now);
let app = router(AppState::with_waker(
store,
clock,
Waker::new(args.push_loopback),
));
let mut state = AppState::with_waker(store, clock, Waker::new(args.push_loopback));
if let Some(path) = &args.turn_secret_file {
// Read once; trailing whitespace from an editor or `echo` is not part of the secret. Never printed.
let secret = match std::fs::read(path) {
Ok(bytes) if !bytes.trim_ascii().is_empty() => bytes.trim_ascii().to_vec(),
_ => {
eprintln!("tabellarius-relay: cannot read the TURN secret file");
std::process::exit(2);
}
};
state = state.with_turn(tabellarius_relay::turn::Turn::new(secret, args.turn_urls.clone()));
}
let app = router(state);
let shutdown = async {
let _ = tokio::signal::ctrl_c().await;
};