[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:
@@ -27,8 +27,15 @@ pub const INVITE_TTL_SECS: i64 = 7 * 24 * 3600;
|
||||
pub const MAX_PUSH_ENDPOINT_BYTES: usize = 1000;
|
||||
/// The body of every wake: a constant, so it carries nothing (`PROTOCOL.md` §6).
|
||||
pub const WAKE_BODY: &[u8] = b"wake";
|
||||
/// A mailbox is woken at most once in this many seconds.
|
||||
pub const WAKE_EVERY_SECS: i64 = 60;
|
||||
/// A mailbox is woken at most once in this many seconds. 10 since 2026-12-03 (was 60), so a call right after a
|
||||
/// message still wakes a closed app (`.agents/features/calls-relay.md`).
|
||||
pub const WAKE_EVERY_SECS: i64 = 10;
|
||||
/// The longest a fetch with `?wait=` is held when nothing is waiting (`calls-relay.md`).
|
||||
pub const MAX_WAIT_SECS: u64 = 25;
|
||||
/// How long a TURN credential from `POST /v0/mailboxes/{id}/turn` is valid.
|
||||
pub const TURN_TTL_SECS: u32 = 600;
|
||||
/// TURN credentials one mailbox may get in an hour.
|
||||
pub const TURN_PER_HOUR: u32 = 30;
|
||||
/// Every file chunk on the wire is exactly this many bytes, the last one too (250 KiB; G41,
|
||||
/// `.agents/features/files.md` §2.1).
|
||||
pub const FILE_CHUNK_BYTES: usize = 256_000;
|
||||
@@ -351,6 +358,17 @@ pub struct ClaimedInvite {
|
||||
pub key_package: KeyPackageBytes,
|
||||
}
|
||||
|
||||
/// `POST /v0/mailboxes/{id}/turn`: a TURN REST API pair for coturn's `use-auth-secret`. `username` is
|
||||
/// `<expiry>:<random>`, `password` base64(HMAC-SHA1(secret, username)); valid [`TURN_TTL_SECS`]. Names no mailbox.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct TurnCredentials {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
pub ttl: u32,
|
||||
pub urls: Vec<String>,
|
||||
}
|
||||
|
||||
/// `GET /version`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
|
||||
Reference in New Issue
Block a user