Add config option for dns passthru for appservices. (#158)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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