From 2d0845431d6f7f6c8f479fa88b2b2c0acb31e8f3 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 14 Apr 2026 14:38:07 +0200 Subject: [PATCH] change --- src/config.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config.rs b/src/config.rs index fbb784e..674f7a2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -183,7 +183,7 @@ impl FederationConfig { } let allow_local = std::env::var("DANGER_FEDERATION_ALLOW_LOCAL_IP").is_ok(); - if !allow_local && self.is_valid_ip(&url).await.is_err() { + if !allow_local && validate_ip(&url).await.is_err() { return Err(Error::DomainResolveError(domain.to_string())); } } @@ -222,15 +222,6 @@ impl FederationConfig { pub fn domain(&self) -> &str { &self.domain } - - /// Resolve domain of the url and throw error if it points to local/private IP. - pub async fn is_valid_ip(&self, url: &Url) -> Result<(), Error> { - if self.debug { - return Ok(()); - } - - validate_ip(url).await - } } impl FederationConfigBuilder { @@ -387,6 +378,15 @@ impl Data { ) .await } + + /// Resolve domain of the url and throw error if it points to local/private IP. + pub async fn is_valid_ip(&self, url: &Url) -> Result<(), Error> { + if self.config.debug { + return Ok(()); + } + + validate_ip(url).await + } } impl Deref for Data {