@@ -14,9 +14,9 @@ use std::{
1414use hickory_resolver:: {
1515 config:: { ResolverConfig , ResolverOpts } ,
1616 name_server:: TokioConnectionProvider ,
17- proto:: ProtoErrorKind ,
17+ proto:: { ProtoError , ProtoErrorKind } ,
1818 system_conf:: read_system_conf,
19- Name , ResolveError , ResolveErrorKind , TokioResolver ,
19+ Name , TokioResolver ,
2020} ;
2121
2222use crate :: {
@@ -35,32 +35,32 @@ pub struct DnsEntry<T> {
3535}
3636
3737impl MessageAuthenticator {
38- pub fn new_cloudflare_tls ( ) -> Result < Self , ResolveError > {
38+ pub fn new_cloudflare_tls ( ) -> Result < Self , ProtoError > {
3939 Self :: new ( ResolverConfig :: cloudflare_tls ( ) , ResolverOpts :: default ( ) )
4040 }
4141
42- pub fn new_cloudflare ( ) -> Result < Self , ResolveError > {
42+ pub fn new_cloudflare ( ) -> Result < Self , ProtoError > {
4343 Self :: new ( ResolverConfig :: cloudflare ( ) , ResolverOpts :: default ( ) )
4444 }
4545
46- pub fn new_google ( ) -> Result < Self , ResolveError > {
46+ pub fn new_google ( ) -> Result < Self , ProtoError > {
4747 Self :: new ( ResolverConfig :: google ( ) , ResolverOpts :: default ( ) )
4848 }
4949
50- pub fn new_quad9 ( ) -> Result < Self , ResolveError > {
50+ pub fn new_quad9 ( ) -> Result < Self , ProtoError > {
5151 Self :: new ( ResolverConfig :: quad9 ( ) , ResolverOpts :: default ( ) )
5252 }
5353
54- pub fn new_quad9_tls ( ) -> Result < Self , ResolveError > {
54+ pub fn new_quad9_tls ( ) -> Result < Self , ProtoError > {
5555 Self :: new ( ResolverConfig :: quad9_tls ( ) , ResolverOpts :: default ( ) )
5656 }
5757
58- pub fn new_system_conf ( ) -> Result < Self , ResolveError > {
58+ pub fn new_system_conf ( ) -> Result < Self , ProtoError > {
5959 let ( config, options) = read_system_conf ( ) ?;
6060 Self :: new ( config, options)
6161 }
6262
63- pub fn new ( config : ResolverConfig , options : ResolverOpts ) -> Result < Self , ResolveError > {
63+ pub fn new ( config : ResolverConfig , options : ResolverOpts ) -> Result < Self , ProtoError > {
6464 Ok ( MessageAuthenticator (
6565 TokioResolver :: builder_with_config ( config, TokioConnectionProvider :: default ( ) )
6666 . with_options ( options)
@@ -406,28 +406,19 @@ impl MessageAuthenticator {
406406 )
407407 } ) ) ,
408408 Err ( err) => match err. kind ( ) {
409- ResolveErrorKind :: Proto ( proto) => {
410- if let ProtoErrorKind :: NoRecordsFound { .. } = proto. kind ( ) {
411- Ok ( false )
412- } else {
413- Err ( err. into ( ) )
414- }
415- }
409+ ProtoErrorKind :: NoRecordsFound { .. } => Ok ( false ) ,
416410 _ => Err ( err. into ( ) ) ,
417411 } ,
418412 }
419413 }
420414}
421415
422- impl From < ResolveError > for Error {
423- fn from ( err : ResolveError ) -> Self {
416+ impl From < ProtoError > for Error {
417+ fn from ( err : ProtoError ) -> Self {
424418 match err. kind ( ) {
425- ResolveErrorKind :: Proto ( proto) => match proto. kind ( ) {
426- ProtoErrorKind :: NoRecordsFound { response_code, .. } => {
427- Error :: DnsRecordNotFound ( * response_code)
428- }
429- _ => Error :: DnsError ( err. to_string ( ) ) ,
430- } ,
419+ ProtoErrorKind :: NoRecordsFound ( response_code) => {
420+ Error :: DnsRecordNotFound ( response_code. response_code )
421+ }
431422 _ => Error :: DnsError ( err. to_string ( ) ) ,
432423 }
433424 }
0 commit comments