From c3461f31e4ca91ddd2682bec05675465ed46824e Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 3 Nov 2023 18:33:04 +0000 Subject: [PATCH] feat: hardcode mail.sangham.net into DNS cache --- src/net.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/net.rs b/src/net.rs index c4b0f3686a..3aca066a75 100644 --- a/src/net.rs +++ b/src/net.rs @@ -1,4 +1,5 @@ //! # Common network utilities. +use std::net::Ipv4Addr; use std::net::{IpAddr, SocketAddr}; use std::pin::Pin; use std::str::FromStr; @@ -119,6 +120,22 @@ async fn lookup_host_with_cache( } } } + + if resolved_addrs.is_empty() { + // Load hardcoded cache if everything else fails. + // + // See and + // for reasons. + // + // In the future we may pre-resolve all provider database addresses + // and build them in. + if hostname == "mail.sangham.net" { + resolved_addrs.push(SocketAddr::new( + IpAddr::V4(Ipv4Addr::new(159, 69, 186, 85)), + port, + )); + } + } } Ok(resolved_addrs)