From d3dbe110d52f8dab59f57968a98e802c89826b0a Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Wed, 17 Apr 2024 19:49:19 -0400
Subject: [PATCH] adjust DNS default config options

Signed-off-by: strawberry <strawberry@puppygock.gay>
---
 conduwuit-example.toml | 10 +++++-----
 src/config/mod.rs      | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/conduwuit-example.toml b/conduwuit-example.toml
index f077ebdf1..65a012a9a 100644
--- a/conduwuit-example.toml
+++ b/conduwuit-example.toml
@@ -477,19 +477,19 @@ allow_profile_lookup_federation_requests = true
 
 # Minimum time-to-live in seconds for entries in the DNS cache. The default may appear high to most
 # administrators; this is by design. Only decrease this if you are using an external DNS cache.
-#dns_min_ttl = 60 * 90
+#dns_min_ttl = 10800
 
 # Minimum time-to-live in seconds for NXDOMAIN entries in the DNS cache. This value is critical for
 # the server to federate efficiently. NXDOMAIN's are assumed to not be returning to the federation
 # and aggressively cached rather than constantly rechecked.
-#dns_min_ttl_nxdomain = 60 * 60 * 24 * 3
+#dns_min_ttl_nxdomain = 86400
 
 # The number of seconds to wait for a reply to a DNS query. Please note that recursive queries can
 # take up to several seconds for some domains, so this value should not be too low.
-#dns_timeout = 5
+#dns_timeout = 10
 
 # Number of retries after a timeout.
-#dns_attempts = 5
+#dns_attempts = 10
 
 # Fallback to TCP on DNS errors. Set this to false if unsupported by nameserver.
 #dns_tcp_fallback = true
@@ -498,7 +498,7 @@ allow_profile_lookup_federation_requests = true
 # This can avoid useless DNS queries if the first nameserver responds with NXDOMAIN or an empty NOERROR response.
 #
 # The default is to query one nameserver and stop (false).
-#query_all_nameservers = false
+#query_all_nameservers = true
 
 
 ### Request Timeouts, Connection Timeouts, and Connection Pooling
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 8fe0823de..f6ec335aa 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -100,7 +100,7 @@ pub struct Config {
 	pub dns_timeout: u64,
 	#[serde(default = "true_fn")]
 	pub dns_tcp_fallback: bool,
-	#[serde(default)]
+	#[serde(default = "true_fn")]
 	pub query_all_nameservers: bool,
 	#[serde(default = "default_max_request_size")]
 	pub max_request_size: u32,
@@ -851,13 +851,13 @@ fn default_cleanup_second_interval() -> u32 {
 
 fn default_dns_cache_entries() -> u32 { 12288 }
 
-fn default_dns_min_ttl() -> u64 { 60 * 90 }
+fn default_dns_min_ttl() -> u64 { 60 * 180 }
 
-fn default_dns_min_ttl_nxdomain() -> u64 { 60 * 60 * 24 * 3 }
+fn default_dns_min_ttl_nxdomain() -> u64 { 60 * 60 * 24 }
 
-fn default_dns_attempts() -> u16 { 5 }
+fn default_dns_attempts() -> u16 { 10 }
 
-fn default_dns_timeout() -> u64 { 5 }
+fn default_dns_timeout() -> u64 { 10 }
 
 fn default_max_request_size() -> u32 {
 	20 * 1024 * 1024 // Default to 20 MB
-- 
GitLab