From e63fb52b928801ef68825a20fca8d3381095230d Mon Sep 17 00:00:00 2001 From: joalopez1206 Date: Tue, 1 Oct 2024 14:32:47 -0300 Subject: [PATCH] edns no ends0 and recmomended payload added --- src/async_resolver/config.rs | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/async_resolver/config.rs b/src/async_resolver/config.rs index 1563cb35..62257d45 100644 --- a/src/async_resolver/config.rs +++ b/src/async_resolver/config.rs @@ -71,9 +71,9 @@ pub struct ResolverConfig { /// Max payload for the resolver. max_payload: u16, /// Version of endns0. - ends0_version: u8, + edns0_version: u8, /// edns0 flags for the resolver. - ends0_do: bool, + edns0_do: bool, /// edns0 options for the resolver. edns0_options: Vec, /// This is whether tsig is enabled or not. @@ -119,11 +119,11 @@ impl ResolverConfig { max_retry_interval_seconds: 10, min_retry_interval_seconds: 1, global_retransmission_limit: 30, - ends0: false, - max_payload: 512, - ends0_version: 0, - ends0_do: true, - ends0_options: Vec::new(), + edns0: false, + max_payload: RECOMMENDED_MAX_PAYLOAD as u16, + edns0_version: 0, + edns0_do: false, + edns0_options: Vec::new(), tsig: false, key_name: None, key: Vec::new(), @@ -166,9 +166,9 @@ impl ResolverConfig { global_retransmission_limit: global_retransmission_limit, edns0: false, max_payload: 512, - ends0_version: 0, - ends0_do: true, - ends0_options: Vec::new(), + edns0_version: 0, + edns0_do: false, + edns0_options: Vec::new(), tsig: false, key_name: None, key: Vec::new(), @@ -262,13 +262,13 @@ impl ResolverConfig { /// resolver_config.add_edns0_to_message(&message); /// ``` pub fn add_edns0_to_message(&self, message: &mut DnsMessage) { - if self.ends0 { + if self.edns0 { message.add_edns0( Some(self.get_max_payload()), Rcode::NOERROR, - self.get_ends0_version(), - self.get_ends0_do(), - Some(self.get_ends0_options())); + self.get_edns0_version(), + self.get_edns0_do(), + Some(self.get_edns0_options())); } } @@ -364,12 +364,12 @@ impl ResolverConfig { self.max_payload } - pub fn get_ends0_version(&self) -> u8 { - self.ends0_version + pub fn get_edns0_version(&self) -> u8 { + self.edns0_version } - pub fn get_ends0_do(&self) -> bool { - self.ends0_do + pub fn get_edns0_do(&self) -> bool { + self.edns0_do } pub fn get_edns0_options(&self) -> Vec { @@ -453,11 +453,11 @@ impl ResolverConfig{ } pub fn set_ends0_version(&mut self, ends0_version: u8) { - self.ends0_version = ends0_version; + self.edns0_version = ends0_version; } pub fn set_ends0_do(&mut self, ends0_do: bool) { - self.ends0_do = ends0_do; + self.edns0_do = ends0_do; } pub fn set_ends0_options(&mut self, ends0_options: Vec) {