mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-07 11:08:56 +00:00
dns-resolver: externalize unwrapping on UnboundResolver initialization
This commit is contained in:
committed by
Wez Furlong
parent
a9132e201d
commit
4553cafeca
@@ -30,7 +30,7 @@ static IP_CACHE: LazyLock<StdMutex<LruCacheWithTtl<Name, Arc<Vec<IpAddr>>>>> =
|
||||
|
||||
#[cfg(feature = "default-unbound")]
|
||||
fn default_resolver() -> Resolver {
|
||||
Resolver::Unbound(UnboundResolver::new())
|
||||
Resolver::Unbound(UnboundResolver::new().unwrap())
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "default-unbound"))]
|
||||
|
||||
@@ -54,14 +54,14 @@ pub struct UnboundResolver {
|
||||
|
||||
#[cfg(feature = "unbound")]
|
||||
impl UnboundResolver {
|
||||
pub fn new() -> Self {
|
||||
pub fn new() -> Result<Self, libunbound::Error> {
|
||||
// This resolves directly against the root
|
||||
let context = Context::new().unwrap();
|
||||
let context = Context::new()?;
|
||||
// and enables DNSSEC
|
||||
context.add_builtin_trust_anchors().unwrap();
|
||||
Self {
|
||||
cx: context.into_async().unwrap(),
|
||||
}
|
||||
context.add_builtin_trust_anchors()?;
|
||||
Ok(Self {
|
||||
cx: context.into_async()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user