chore(testnet): update pkarr-relay

This commit is contained in:
nazeh
2025-02-13 12:37:45 +03:00
parent f423257017
commit 9ac41b43ec
3 changed files with 22 additions and 25 deletions

4
Cargo.lock generated
View File

@@ -1990,9 +1990,9 @@ dependencies = [
[[package]]
name = "pkarr-relay"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7aaf659e9dee61ed790ce8d5e43f439e7444904772365bd975f44005c4a164b0"
checksum = "562497bdc2c273da1cbedd536b4ab6b8127db744d8423ce46bc0c63f06d75239"
dependencies = [
"anyhow",
"axum",

View File

@@ -14,7 +14,7 @@ categories = ["web-programming", "authentication", "cryptography"]
anyhow = "1.0.95"
http-relay = "0.1.0"
mainline = "5.2.0"
pkarr-relay = "0.2.0"
pkarr-relay = "0.3.0"
pubky = { version = "0.3.0", path = "../pubky" }
pubky-common = "0.2.0"
pubky-homeserver = { version = "0.1.0", path = "../pubky-homeserver" }

View File

@@ -39,29 +39,26 @@ impl Testnet {
let storage = std::env::temp_dir().join(Timestamp::now().to_string());
// TODO: add a builder for pkarr relay for consistency?
let relay = {
let mut config = pkarr_relay::Config {
http_port: 15411,
cache_path: Some(storage.join("pkarr-relay")),
rate_limiter: None,
..Default::default()
};
let mut builder = pkarr_relay::Relay::builder();
builder
.http_port(15411)
.storage(storage.clone())
.disable_rate_limiter()
.pkarr(|pkarr| {
pkarr
.request_timeout(Duration::from_millis(100))
.bootstrap(&dht.bootstrap)
.dht(|builder| {
if !dht.bootstrap.first().unwrap().contains("6881") {
builder.server_mode().port(6881);
}
config
.pkarr
.request_timeout(Duration::from_millis(100))
.bootstrap(&dht.bootstrap)
.dht(|builder| {
if !dht.bootstrap.first().unwrap().contains("6881") {
builder.server_mode().port(6881);
}
builder
});
unsafe { pkarr_relay::Relay::run(config).await? }
};
builder
.bootstrap(&dht.bootstrap)
.request_timeout(Duration::from_millis(200))
})
});
let relay = unsafe { builder.run() }.await?;
let mut builder = Homeserver::builder();
builder