@@ -5,12 +5,41 @@ use hickory_resolver::config::ResolverConfig as HickoryResolverConfig;
55///
66/// This is a thin wrapper around a `hickory_resolver::config::ResolverConfig` provided to ensure
77/// API stability.
8- #[ derive( Clone , Debug , PartialEq ) ]
8+ #[ derive( Clone , Debug ) ]
9+ #[ cfg_attr( not( feature = "dns-resolver" ) , derive( PartialEq ) ) ]
910pub struct ResolverConfig {
1011 #[ cfg( feature = "dns-resolver" ) ]
1112 pub ( crate ) inner : HickoryResolverConfig ,
1213}
1314
15+ #[ cfg( feature = "dns-resolver" ) ]
16+ impl PartialEq for ResolverConfig {
17+ fn eq ( & self , other : & Self ) -> bool {
18+ let ( left, right) = ( & self . inner , & other. inner ) ;
19+
20+ if !( left. domain ( ) == right. domain ( )
21+ && left. search ( ) == right. search ( )
22+ && left. name_servers ( ) . len ( ) == right. name_servers ( ) . len ( ) )
23+ {
24+ return false ;
25+ }
26+
27+ for ( a, b) in std:: iter:: zip ( left. name_servers ( ) , right. name_servers ( ) ) {
28+ if !( a. socket_addr == b. socket_addr
29+ && a. protocol == b. protocol
30+ && a. tls_dns_name == b. tls_dns_name
31+ && a. http_endpoint == b. http_endpoint
32+ && a. trust_negative_responses == b. trust_negative_responses
33+ && a. bind_addr == b. bind_addr )
34+ {
35+ return false ;
36+ }
37+ }
38+
39+ true
40+ }
41+ }
42+
1443#[ cfg( feature = "dns-resolver" ) ]
1544impl ResolverConfig {
1645 /// Creates a default configuration, using 1.1.1.1, 1.0.0.1 and 2606:4700:4700::1111,
0 commit comments