From b7e7c28275905843aa8e3a17fd51b94be6714e7c Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Sat, 30 Sep 2023 06:28:14 -0700 Subject: [PATCH] Recognize localdev.me as "local" domain (#2619) --- ethers-providers/src/rpc/provider.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ethers-providers/src/rpc/provider.rs b/ethers-providers/src/rpc/provider.rs index f34515c87..52d5dd5fa 100644 --- a/ethers-providers/src/rpc/provider.rs +++ b/ethers-providers/src/rpc/provider.rs @@ -1501,6 +1501,7 @@ impl ProviderExt for Provider { /// ``` /// use ethers_providers::is_local_endpoint; /// assert!(is_local_endpoint("http://localhost:8545")); +/// assert!(is_local_endpoint("http://test.localdev.me")); /// assert!(is_local_endpoint("http://169.254.0.0:8545")); /// assert!(is_local_endpoint("http://127.0.0.1:8545")); /// assert!(!is_local_endpoint("http://206.71.50.230:8545")); @@ -1513,7 +1514,9 @@ pub fn is_local_endpoint(endpoint: &str) -> bool { if let Ok(url) = Url::parse(endpoint) { if let Some(host) = url.host() { match host { - Host::Domain(domain) => return domain.contains("localhost"), + Host::Domain(domain) => { + return domain.contains("localhost") || domain.contains("localdev.me") + } Host::Ipv4(ipv4) => { return ipv4 == Ipv4Addr::LOCALHOST || ipv4.is_link_local() ||