mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 21:26:50 +00:00
Add config option for dns passthru for appservices. (#158)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
a9f1926654
commit
bf8aa57d03
4 files changed
+41
-5
No files matched your search
@@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use either::Either;
|
||||
use ipaddress::IPAddress;
|
||||
use reqwest::redirect;
|
||||
use reqwest::{dns::Resolve, redirect};
|
||||
use tuwunel_core::{Config, Result, err, implement, trace};
|
||||
|
||||
use crate::{service, services::OnceServices};
|
||||
@@ -98,7 +98,7 @@ impl crate::Service for Service {
|
||||
.redirect(redirect::Policy::limited(2))),
|
||||
|
||||
appservice: create_client!(config, services; base(config)?
|
||||
.dns_resolver2(Arc::clone(&services.resolver.resolver))
|
||||
.dns_resolver2(appservice_resolver(&services))
|
||||
.connect_timeout(Duration::from_secs(5))
|
||||
.read_timeout(Duration::from_secs(config.appservice_timeout))
|
||||
.timeout(Duration::from_secs(config.appservice_timeout))
|
||||
@@ -220,6 +220,14 @@ fn builder_interface(
|
||||
}
|
||||
}
|
||||
|
||||
fn appservice_resolver(services: &Arc<OnceServices>) -> Arc<dyn Resolve> {
|
||||
if services.server.config.dns_passthru_appservices {
|
||||
services.resolver.resolver.passthru.clone()
|
||||
} else {
|
||||
services.resolver.resolver.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[implement(Service)]
|
||||
|
||||
Reference in new issue
Block a user