Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Recognize localdev.me as "local" domain #2619

Merged
merged 2 commits into from
Sep 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ethers-providers/src/rpc/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ impl ProviderExt for Provider<HttpProvider> {
/// ```
/// 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"));
Expand All @@ -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() ||
Expand Down