Use rustls and regex-lite; refactor HTTP API

Switch reqwest to rustls-no-provider and add rustls crate; install
rustls provider at startup. Replace regex::Regex with regex_lite::Regex
across code. Consolidate api_get/post/put/delete into a single
api_request that takes a Method and optional body. Add .dockerignore and
UPX compression in Dockerfile. Remove unused domain/IDNA code, trim dead
helpers, tweak tokio flavor and release opt-level, and update tests to
use crate::test_client()
This commit is contained in:
Timothy Miller
2026-03-25 14:49:47 -04:00
parent 9b140d2350
commit 3e2b8a3a40
12 changed files with 135 additions and 1212 deletions

View File

@@ -26,10 +26,6 @@ impl IpType {
}
}
#[allow(dead_code)]
pub fn all() -> &'static [IpType] {
&[IpType::V4, IpType::V6]
}
}
/// All supported provider types
@@ -879,7 +875,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let url = format!("{}/cdn-cgi/trace", server.uri());
let timeout = Duration::from_secs(5);
@@ -919,7 +915,7 @@ mod tests {
// We can't override the hardcoded primary/fallback URLs, but we can test
// the custom URL path: first with a failing URL, then a succeeding one.
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
@@ -1012,7 +1008,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
@@ -1035,7 +1031,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
@@ -1056,7 +1052,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
let url = format!("{}/my-ip", server.uri());
@@ -1076,7 +1072,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
let url = format!("{}/my-ip", server.uri());
@@ -1140,7 +1136,7 @@ mod tests {
.mount(&server)
.await;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
let url = format!("{}/my-ip", server.uri());
@@ -1351,7 +1347,7 @@ mod tests {
"5.6.7.8".parse().unwrap(),
],
};
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
@@ -1369,7 +1365,7 @@ mod tests {
"2001:db8::1".parse().unwrap(),
],
};
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);
@@ -1383,7 +1379,7 @@ mod tests {
#[tokio::test]
async fn test_none_detect_ips_returns_empty() {
let provider = ProviderType::None;
let client = Client::new();
let client = crate::test_client();
let ppfmt = PP::default_pp();
let timeout = Duration::from_secs(5);