add query_over_tcp_only config option for hickory
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
@@ -103,6 +103,8 @@ pub(crate) struct Config {
|
||||
pub(crate) dns_tcp_fallback: bool,
|
||||
#[serde(default = "true_fn")]
|
||||
pub(crate) query_all_nameservers: bool,
|
||||
#[serde(default)]
|
||||
pub(crate) query_over_tcp_only: bool,
|
||||
#[serde(default = "default_ip_lookup_strategy")]
|
||||
pub(crate) ip_lookup_strategy: u8,
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@ impl Resolver {
|
||||
for sys_conf in sys_conf.name_servers() {
|
||||
let mut ns = sys_conf.clone();
|
||||
|
||||
if config.query_over_tcp_only {
|
||||
ns.protocol = hickory_resolver::config::Protocol::Tcp;
|
||||
}
|
||||
|
||||
ns.trust_negative_responses = !config.query_all_nameservers;
|
||||
|
||||
conf.add_name_server(ns);
|
||||
|
||||
Reference in New Issue
Block a user