idoh 0.1.6

Fast and secure DNS over HTTPS resolution / 极速安全的 DoH 解析库
Documentation
use aok::{OK, Void};
use log::info;

#[static_init::constructor(0)]
extern "C" fn _log_init() {
  log_init::init();
}

#[tokio::test]
async fn test_async() -> Void {
  let domain = "gmail.com";

  let r = idoh::resolve(domain, "MX", |li| {
    let mut r = Vec::with_capacity(li.len());
    for i in li {
      log::info!("  {:?}", i);
      if i.r#type == idoh::record_type::MX {
        r.push(i.data);
      }
    }
    Ok(Some(r))
  })
  .await;

  if let Ok(txt) = xerr::ok!(r) {
    info!("{txt:?}");
  }

  OK
}