diff --git a/Cargo.lock b/Cargo.lock index 5ee2a2a..f53dadf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -802,6 +802,21 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -809,6 +824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -817,6 +833,23 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + [[package]] name = "futures-lite" version = "2.5.0" @@ -856,9 +889,13 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -1704,7 +1741,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkarr" version = "3.0.0" -source = "git+https://github.com/Pubky/pkarr?branch=v3#6a6c40bf7a6b0957e3222bd193ca4ed858c72516" +source = "git+https://github.com/Pubky/pkarr?branch=v3#54732ea14bb652e137547dda1ed295ebf1d7aa57" dependencies = [ "base32", "byteorder", @@ -1713,6 +1750,7 @@ dependencies = [ "dyn-clone", "ed25519-dalek", "flume", + "futures", "futures-lite", "genawaiter", "getrandom", diff --git a/pubky/src/native.rs b/pubky/src/native.rs index 63a1906..9a3e49f 100644 --- a/pubky/src/native.rs +++ b/pubky/src/native.rs @@ -1,4 +1,4 @@ -use std::time::Duration; +use std::{sync::Arc, time::Duration}; use pkarr::mainline::Testnet; @@ -49,7 +49,7 @@ impl Settings { Ok(Client { http: reqwest::Client::builder() .cookie_store(true) - // .dns_resolver(Arc::new(dns_resolver)) + .dns_resolver(Arc::new(pkarr.clone())) .user_agent(DEFAULT_USER_AGENT) .build() .unwrap(), diff --git a/pubky/src/native/api/http.rs b/pubky/src/native/api/http.rs index 5f29b6b..56953b0 100644 --- a/pubky/src/native/api/http.rs +++ b/pubky/src/native/api/http.rs @@ -8,9 +8,12 @@ impl Client { /// Returns a `RequestBuilder`, which will allow setting headers and /// the request body before sending. /// - /// Differs from [reqwest::Client::request], in that it can make requests - /// to URLs with a [pkarr::PublicKey] as Top Level Domain, by resolving - /// corresponding endpoints, and verifying TLS certificates accordingly. + /// Differs from [reqwest::Client::request], in that it can make requests to: + /// 1. HTTP(s) URLs with with a [pkarr::PublicKey] as Top Level Domain, by resolving + /// corresponding endpoints, and verifying TLS certificates accordingly. + /// (example: `https://o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy`) + /// 2. Pubky URLs like `pubky://o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy` + /// by converting the url into `https://_pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy` /// /// # Errors /// @@ -27,7 +30,7 @@ mod tests { use crate::Client; - // #[tokio::test] + #[tokio::test] async fn http_get_pubky() { let testnet = Testnet::new(10).unwrap();