Skip to content

Commit

Permalink
Use aquadoggo v0.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Jun 18, 2024
1 parent 53162ec commit 4ff184b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/p2panda/native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flutter_rust_bridge_codegen = "1.82.6"
[dependencies]
android_logger = "0.13.1"
anyhow = "1.0.75"
aquadoggo = "0.7.3"
aquadoggo = "0.7.4"
ed25519-dalek = "1.0.1"
flutter_rust_bridge = "1.82.6"
log = "0.4.19"
Expand Down
26 changes: 4 additions & 22 deletions packages/p2panda/native/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use std::net::{SocketAddr, ToSocketAddrs};

use android_logger::{Config, FilterBuilder};
use anyhow::{anyhow, Result};
use aquadoggo::{AllowList, Configuration};
Expand Down Expand Up @@ -230,12 +228,6 @@ pub fn start_node(
),
);

// In case a domain name based relay address was passed we need to perfom an ip lookup.
let relay_socket_addresses = relay_addresses
.iter()
.filter_map(|address_str| address_str.to_socket_addrs().unwrap_or_default().next())
.collect::<Vec<SocketAddr>>();

// Set node configuration
let mut config = Configuration::default();
config.database_url = database_url;
Expand All @@ -248,20 +240,10 @@ pub fn start_node(
.collect::<Result<Vec<SchemaId>, _>>()?;
config.allow_schema_ids = AllowList::Set(allow_schema_ids);
config.network.mdns = true;
config.network.relay_addresses = relay_socket_addresses
.iter()
.map(|address| {
// Format address correctly as Multiaddr string.
let ip_version = if address.is_ipv4() { "ip4" } else { "ip6" };
format!(
"/{}/{}/udp/{}/quic-v1",
ip_version,
address.ip().to_string(),
address.port()
)
.parse()
})
.collect::<Result<_, _>>()?;
config.network.relay_addresses = relay_addresses
.into_iter()
.map(|address| address.into())
.collect();

// Convert key pair from external FFI type to internal one
let secret_key: SecretKey = SecretKey::from_bytes(&key_pair.private_key())?;
Expand Down

0 comments on commit 4ff184b

Please sign in to comment.