Skip to content

Commit

Permalink
deps: update pkarr to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Feb 14, 2025
1 parent 6f923a3 commit 4bdd95e
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 258 deletions.
131 changes: 79 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions iroh-dns-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ humantime-serde = "1.1.1"
iroh-metrics = { version = "0.31.0" }
lru = "0.12.3"
n0-future = "0.1.2"
pkarr = { version = "2.3.1", features = [ "async", "relay", "dht"], default-features = false }
pkarr = { version = "3", features = ["relays", "dht"], default-features = false }
rcgen = "0.13"
redb = "2.0.0"
regex = "1.10.3"
Expand Down Expand Up @@ -61,7 +61,7 @@ z32 = "1.1.1"
criterion = "0.5.1"
hickory-resolver = "=0.25.0-alpha.5"
iroh = { path = "../iroh" }
pkarr = { version = "2.3.1", features = ["rand"] }
mainline = "5"
rand = "0.8"
rand_chacha = "0.3.1"
testresult = "0.4.1"
Expand Down
29 changes: 12 additions & 17 deletions iroh-dns-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod tests {
dns::{node_info::NodeInfo, DnsResolver},
SecretKey,
};
use pkarr::{PkarrClient, SignedPacket};
use pkarr::{SignedPacket, Timestamp};
use testresult::TestResult;
use tracing_test::traced_test;
use url::Url;
Expand Down Expand Up @@ -103,13 +103,13 @@ mod tests {
30,
dns::rdata::RData::AAAA(Ipv6Addr::LOCALHOST.into()),
));
SignedPacket::from_packet(&keypair, &packet)?
SignedPacket::new(&keypair, &packet.answers, Timestamp::now())?
};
let pkarr_client = pkarr::PkarrRelayClient::new(pkarr::RelaySettings {
relays: vec![pkarr_relay_url.to_string()],
..Default::default()
})?;
pkarr_client.as_async().publish(&signed_packet).await?;
let pkarr_client = pkarr::Client::builder()
.no_default_network()
.relays(&[pkarr_relay_url])?
.build()?;
pkarr_client.publish(&signed_packet, None).await?;

use hickory_server::proto::rr::Name;
let pubkey = signed_packet.public_key().to_z32();
Expand Down Expand Up @@ -221,7 +221,7 @@ mod tests {
#[traced_test]
async fn integration_mainline() -> Result<()> {
// run a mainline testnet
let testnet = pkarr::mainline::dht::Testnet::new(5);
let testnet = mainline::Testnet::new(5)?;
let bootstrap = testnet.bootstrap.clone();

// spawn our server with mainline support
Expand All @@ -239,13 +239,11 @@ mod tests {
let signed_packet = node_info.to_pkarr_signed_packet(&secret_key, 30)?;

// publish the signed packet to our DHT
let pkarr = PkarrClient::builder()
.dht_settings(pkarr::mainline::dht::DhtSettings {
bootstrap: Some(testnet.bootstrap),
..Default::default()
})
let pkarr = pkarr::Client::builder()
.no_default_network()
.dht(|builder| builder.bootstrap(&testnet.bootstrap))
.build()?;
pkarr.publish(&signed_packet)?;
pkarr.publish(&signed_packet, None).await?;

// resolve via DNS from our server, which will lookup from our DHT
let resolver = test_resolver(nameserver);
Expand All @@ -255,9 +253,6 @@ mod tests {
assert_eq!(res.relay_url.map(Url::from), Some(relay_url));

server.shutdown().await?;
for mut node in testnet.nodes {
node.shutdown()?;
}
Ok(())
}

Expand Down
Loading

0 comments on commit 4bdd95e

Please sign in to comment.