···1-pub use merde::CowStr;
2-3pub mod error;
4pub mod lexicons;
05pub use lexicons::*;
0067pub use crate::error::{Error, IoError, ParseError, SerDeError};
0000089/// too many cows, so we have conversions
10pub fn mcow_to_cow(cow: CowStr<'_>) -> std::borrow::Cow<'_, str> {
···30 markdown_weaver::CowStr::Inlined(s) => std::borrow::Cow::Owned(s.as_ref().to_owned()),
31 }
32}
0000000000000000000000000000
···001pub mod error;
2pub mod lexicons;
3+pub mod oauth;
4pub use lexicons::*;
5+6+use atrium_identity::handle::DnsTxtResolver;
78pub use crate::error::{Error, IoError, ParseError, SerDeError};
9+10+/// Canonical Cow for us, thanks Amos
11+pub use merde::CowStr;
12+13+use hickory_resolver::TokioAsyncResolver;
1415/// too many cows, so we have conversions
16pub fn mcow_to_cow(cow: CowStr<'_>) -> std::borrow::Cow<'_, str> {
···36 markdown_weaver::CowStr::Inlined(s) => std::borrow::Cow::Owned(s.as_ref().to_owned()),
37 }
38}
39+40+pub struct HickoryDnsTxtResolver {
41+ resolver: TokioAsyncResolver,
42+}
43+44+impl Default for HickoryDnsTxtResolver {
45+ fn default() -> Self {
46+ Self {
47+ resolver: TokioAsyncResolver::tokio_from_system_conf()
48+ .expect("failed to create resolver"),
49+ }
50+ }
51+}
52+53+impl DnsTxtResolver for HickoryDnsTxtResolver {
54+ async fn resolve(
55+ &self,
56+ query: &str,
57+ ) -> core::result::Result<Vec<String>, Box<dyn std::error::Error + Send + Sync + 'static>> {
58+ Ok(self
59+ .resolver
60+ .txt_lookup(query)
61+ .await?
62+ .iter()
63+ .map(|txt| txt.to_string())
64+ .collect())
65+ }
66+}