Skip to content

Commit

Permalink
fix(dns-seeds): use correct cloudflare resolver default (#4029)
Browse files Browse the repository at this point in the history
Description
---
- changes default domain name server to `1.1.1.1:853/cloudflare-dns.com`

Motivation and Context
---
Previous default does not work (connection refused)

How Has This Been Tested?
---
Unit test that checks `seeds.weatherwax.tari.com` works
Manually, base node adds all seeds from  `seeds.weatherwax.tari.com`
  • Loading branch information
sdbondi authored Apr 12, 2022
1 parent efd2114 commit c95e589
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 96 deletions.
9 changes: 3 additions & 6 deletions base_layer/p2p/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{
path::{Path, PathBuf},
str::FromStr,
};
use std::path::{Path, PathBuf};

use serde::{Deserialize, Serialize};
use tari_common::{
Expand All @@ -37,7 +34,7 @@ use tari_common::{
use tari_comms::multiaddr::Multiaddr;
use tari_comms_dht::DhtConfig;

use crate::transport::TransportConfig;
use crate::{transport::TransportConfig, DEFAULT_DNS_NAME_SERVER};

/// Peer seed configuration
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -65,7 +62,7 @@ impl Default for PeerSeedsConfig {
override_from: None,
peer_seeds: StringList::default(),
dns_seeds: StringList::default(),
dns_seeds_name_server: DnsNameServer::from_str("1.1.1.1:53/cloudflare.net").unwrap(),
dns_seeds_name_server: DEFAULT_DNS_NAME_SERVER.parse().unwrap(),
dns_seeds_use_dnssec: false,
}
}
Expand Down
84 changes: 0 additions & 84 deletions base_layer/p2p/src/depr_transport.rs

This file was deleted.

12 changes: 11 additions & 1 deletion base_layer/p2p/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,17 @@ impl P2pInitializer {
return Ok(Vec::new());
}

debug!(target: LOG_TARGET, "Resolving DNS seeds...");
debug!(
target: LOG_TARGET,
"Resolving DNS seeds (NS:{}, addresses: {})...",
config.dns_seeds_name_server,
config
.dns_seeds
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(",")
);
let start = Instant::now();

let resolver = if config.dns_seeds_use_dnssec {
Expand Down
8 changes: 3 additions & 5 deletions base_layer/p2p/src/peer_seeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ mod test {

#[tokio::test]
async fn it_returns_seeds_from_real_address() {
let mut resolver = DnsSeedResolver {
client: DnsClient::connect(DEFAULT_DNS_NAME_SERVER.parse().unwrap())
.await
.unwrap(),
};
let mut resolver = DnsSeedResolver::connect(DEFAULT_DNS_NAME_SERVER.parse().unwrap())
.await
.unwrap();
let seeds = resolver.resolve("seeds.weatherwax.tari.com").await.unwrap();
println!("{:?}", seeds);
assert!(!seeds.is_empty());
Expand Down

0 comments on commit c95e589

Please sign in to comment.