Expand description
Requests TURN credentials from the configured provider.
Answers come in the TURN REST API shape or as WebRTC ICE servers, and both fold into the single username, password and URI list a Matrix client takes. Cloudflare credentials are capped at the 48-hour lifetime Cloudflare allows, and the port 53 URIs it offers, which browsers refuse, are dropped.
Re-exportsΒ§
use std::iter::once;πuse std::time::Duration;πuse reqwest::Error as HttpError;πuse reqwest::RequestBuilder;πuse reqwest::Response;πuse serde::Deserialize;πuse serde::Deserialize;πuse serde::Serialize;πuse serde::Serialize;πuse tuwunel_core::Err;πuse tuwunel_core::Result;πuse tuwunel_core::config::turn::Cloudflare;πuse tuwunel_core::config::turn::Endpoint;πuse tuwunel_core::config::turn::Provider;πuse tuwunel_core::config::turn::Turn;πuse tuwunel_core::either;πuse tuwunel_core::either::Either;πuse tuwunel_core::err;πuse tuwunel_core::implement;πuse tuwunel_core::utils::resolve_secret;πuse url::Url;πuse super::Credentials;πuse super::Service;πuse crate::client::read_response_capped;π
StructsΒ§
- Generate
IceServers π - IceServer π
EnumsΒ§
- Answer π
- Answer shapes accepted from a credential provider.
ConstantsΒ§
- CLOUDFLARE_
MAX_ πTTL - Longest credential lifetime Cloudflare grants.
- MAX_
ANSWER π - Bound on the providerβs answer.
- TIMEOUT π
- Bound on one request to the provider.
FunctionsΒ§
- ice_
credentials π - Folds WebRTC ICE servers into the one username and password a Matrix client takes.
- is_turn π
- request_
credentials π - Sends the request and converts the providerβs answer into credentials.
- reserved π
- uses_
port_ π53 - with_
query π