mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
rename Resolver -> FederationResolver and document
This commit is contained in:
parent
e98dd5b9a3
commit
e249aed1cb
1 changed files with 15 additions and 5 deletions
|
|
@ -141,21 +141,29 @@ impl Default for RotationHandler {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) struct Resolver {
|
||||
/// Resolver used for outgoing requests to the federation API.
|
||||
///
|
||||
/// Hostnames that have been mapped to a different domain by SRV records in
|
||||
/// [server discovery][1] are resolved to the SRV record target. This is done to
|
||||
/// get reqwest to check the TLS certificate against the correct hostname
|
||||
/// required in steps 3.3, 3.4, and 4 of the server discovery spec.
|
||||
///
|
||||
/// [1]: https://spec.matrix.org/v1.12/server-server-api/#server-discovery
|
||||
pub(crate) struct FederationResolver {
|
||||
inner: GaiResolver,
|
||||
overrides: Arc<StdRwLock<TlsNameMap>>,
|
||||
}
|
||||
|
||||
impl Resolver {
|
||||
impl FederationResolver {
|
||||
pub(crate) fn new(overrides: Arc<StdRwLock<TlsNameMap>>) -> Self {
|
||||
Resolver {
|
||||
FederationResolver {
|
||||
inner: GaiResolver::new(),
|
||||
overrides,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Resolve for Resolver {
|
||||
impl Resolve for FederationResolver {
|
||||
#[tracing::instrument(skip(self))]
|
||||
fn resolve(&self, name: Name) -> Resolving {
|
||||
self.overrides
|
||||
|
|
@ -234,7 +242,9 @@ impl Service {
|
|||
|
||||
let default_client = reqwest_client_builder(&config)?.build()?;
|
||||
let federation_client = reqwest_client_builder(&config)?
|
||||
.dns_resolver(Arc::new(Resolver::new(tls_name_override.clone())))
|
||||
.dns_resolver(Arc::new(FederationResolver::new(
|
||||
tls_name_override.clone(),
|
||||
)))
|
||||
.build()?;
|
||||
|
||||
// Supported and stable room versions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue