Skip to main content

Module provider

Module provider 

Source
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Β§

GenerateIceServers πŸ”’
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 πŸ”’