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

Commit

Permalink
Recognize localdev.me as "local" domain (#2619)
Browse files Browse the repository at this point in the history
  • Loading branch information
joroshiba authored Sep 30, 2023
1 parent 3b4b47a commit b7e7c28
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit b7e7c28

Please sign in to comment.