From 5454b653fe51f1d35b9ba83f6a0fd38853532e0d Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Mon, 11 Mar 2024 20:18:46 -0400
Subject: [PATCH] switch to hickory-dns / hickory_resolver

trust-dns rebranded to hickry-dns

Signed-off-by: strawberry <strawberry@puppygock.gay>
---
 Cargo.lock                 | 93 +++++++++++++++++++-------------------
 Cargo.toml                 |  2 +-
 src/api/server_server.rs   |  2 +-
 src/service/globals/mod.rs |  2 +-
 4 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 87a9fe75..20321ac0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -426,6 +426,7 @@ dependencies = [
  "either",
  "figment",
  "futures-util",
+ "hickory-resolver",
  "hmac",
  "http",
  "hyper",
@@ -467,7 +468,6 @@ dependencies = [
  "tracing-flame",
  "tracing-opentelemetry",
  "tracing-subscriber",
- "trust-dns-resolver",
  "webpage",
 ]
 
@@ -944,6 +944,51 @@ version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
 
+[[package]]
+name = "hickory-proto"
+version = "0.24.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf"
+dependencies = [
+ "async-trait",
+ "cfg-if",
+ "data-encoding",
+ "enum-as-inner",
+ "futures-channel",
+ "futures-io",
+ "futures-util",
+ "idna 0.4.0",
+ "ipnet",
+ "once_cell",
+ "rand",
+ "thiserror",
+ "tinyvec",
+ "tokio",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "hickory-resolver"
+version = "0.24.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "hickory-proto",
+ "ipconfig",
+ "lru-cache",
+ "once_cell",
+ "parking_lot",
+ "rand",
+ "resolv-conf",
+ "smallvec",
+ "thiserror",
+ "tokio",
+ "tracing",
+]
+
 [[package]]
 name = "hmac"
 version = "0.12.1"
@@ -3161,52 +3206,6 @@ dependencies = [
  "tracing-log",
 ]
 
-[[package]]
-name = "trust-dns-proto"
-version = "0.23.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374"
-dependencies = [
- "async-trait",
- "cfg-if",
- "data-encoding",
- "enum-as-inner",
- "futures-channel",
- "futures-io",
- "futures-util",
- "idna 0.4.0",
- "ipnet",
- "once_cell",
- "rand",
- "smallvec",
- "thiserror",
- "tinyvec",
- "tokio",
- "tracing",
- "url",
-]
-
-[[package]]
-name = "trust-dns-resolver"
-version = "0.23.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6"
-dependencies = [
- "cfg-if",
- "futures-util",
- "ipconfig",
- "lru-cache",
- "once_cell",
- "parking_lot",
- "rand",
- "resolv-conf",
- "smallvec",
- "thiserror",
- "tokio",
- "tracing",
- "trust-dns-proto",
-]
-
 [[package]]
 name = "try-lock"
 version = "0.2.5"
diff --git a/Cargo.toml b/Cargo.toml
index e00f5cd1..882511ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@ base64 = "0.22.0"
 ring = "0.17.8"
 
 # Used when querying the SRV record of other servers
-trust-dns-resolver = "0.23.2"
+hickory-resolver = "0.24.0"
 
 # Used to find matching events for appservices
 regex = "1.10.3"
diff --git a/src/api/server_server.rs b/src/api/server_server.rs
index 48f9e260..b457dd8c 100644
--- a/src/api/server_server.rs
+++ b/src/api/server_server.rs
@@ -13,6 +13,7 @@ use std::{
 use axum::{response::IntoResponse, Json};
 use futures_util::future::TryFutureExt;
 use get_profile_information::v1::ProfileField;
+use hickory_resolver::{error::ResolveError, lookup::SrvLookup};
 use http::header::{HeaderValue, AUTHORIZATION};
 use ipaddress::IPAddress;
 use ruma::{
@@ -52,7 +53,6 @@ use ruma::{
 use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
 use tokio::sync::RwLock;
 use tracing::{debug, error, info, warn};
-use trust_dns_resolver::{error::ResolveError, lookup::SrvLookup};
 
 use crate::{
 	api::client_server::{self, claim_keys_helper, get_keys_helper},
diff --git a/src/service/globals/mod.rs b/src/service/globals/mod.rs
index 63f13457..d3524916 100644
--- a/src/service/globals/mod.rs
+++ b/src/service/globals/mod.rs
@@ -17,6 +17,7 @@ use argon2::Argon2;
 use base64::{engine::general_purpose, Engine as _};
 pub use data::Data;
 use futures_util::FutureExt;
+use hickory_resolver::TokioAsyncResolver;
 use hyper::{
 	client::connect::dns::{GaiResolver, Name},
 	service::Service as HyperService,
@@ -34,7 +35,6 @@ use ruma::{
 };
 use tokio::sync::{broadcast, watch::Receiver, Mutex, RwLock, Semaphore};
 use tracing::{error, info};
-use trust_dns_resolver::TokioAsyncResolver;
 
 use crate::{api::server_server::FedDest, services, Config, Error, Result};