feat: update discv5 bootnodes
This commit is contained in:
parent
803fc37e04
commit
c445be4e26
|
@ -1674,7 +1674,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||
|
||||
[[package]]
|
||||
name = "waku-bindings"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64 0.21.0",
|
||||
|
@ -1697,7 +1697,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-rc.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
|
|
@ -1497,7 +1497,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||
|
||||
[[package]]
|
||||
name = "waku-bindings"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64 0.21.0",
|
||||
|
@ -1517,7 +1517,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-rc.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "waku-bindings"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Daniel Sanchez Quiros <danielsq@status.im>"
|
||||
|
@ -26,7 +26,7 @@ serde_json = "1.0"
|
|||
sscanf = "0.4"
|
||||
smart-default = "0.6"
|
||||
url = "2.3"
|
||||
waku-sys = { version = "0.1.0-rc.3", path = "../waku-sys" }
|
||||
waku-sys = { version = "0.1.0", path = "../waku-sys" }
|
||||
|
||||
[dev-dependencies]
|
||||
futures = "0.3.25"
|
||||
|
|
|
@ -9,7 +9,7 @@ mod utils;
|
|||
|
||||
pub use node::{
|
||||
waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic,
|
||||
waku_dns_discovery, waku_new, Aes256Gcm, DnsInfo, GossipSubParams, Initialized, Key, Multiaddr,
|
||||
waku_dns_discovery, waku_discv5_update_bootnodes, waku_new, Aes256Gcm, DnsInfo, GossipSubParams, Initialized, Key, Multiaddr,
|
||||
Protocol, PublicKey, Running, SecretKey, WakuLogLevel, WakuNodeConfig, WakuNodeHandle,
|
||||
WakuPeerData, WakuPeers,
|
||||
};
|
||||
|
|
|
@ -59,6 +59,26 @@ pub fn waku_dns_discovery(
|
|||
decode_and_free_response(result_ptr)
|
||||
}
|
||||
|
||||
/// Update the bootnodes used by DiscoveryV5 by passing a list of ENRs
|
||||
pub fn waku_discv5_update_bootnodes(
|
||||
bootnodes: Vec<String>
|
||||
) -> Result<()> {
|
||||
let bootnodes_ptr = CString::new(
|
||||
serde_json::to_string(&bootnodes)
|
||||
.expect("Serialization from properly built bootnode array should never fail"),
|
||||
)
|
||||
.expect("CString should build properly from the string vector")
|
||||
.into_raw();
|
||||
|
||||
let result_ptr = unsafe {
|
||||
let res = waku_sys::waku_discv5_update_bootnodes(bootnodes_ptr);
|
||||
drop(CString::from_raw(bootnodes_ptr));
|
||||
res
|
||||
};
|
||||
|
||||
decode_and_free_response::<bool>(result_ptr).map(|_| ())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use url::Url;
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::general::{
|
|||
};
|
||||
|
||||
pub use config::{GossipSubParams, WakuLogLevel, WakuNodeConfig};
|
||||
pub use discovery::{waku_dns_discovery, DnsInfo};
|
||||
pub use discovery::{waku_dns_discovery, waku_discv5_update_bootnodes, DnsInfo};
|
||||
pub use peers::{Protocol, WakuPeerData, WakuPeers};
|
||||
pub use relay::{waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic};
|
||||
pub use store::{waku_local_store_query, waku_store_query};
|
||||
|
@ -312,6 +312,15 @@ impl WakuNodeHandle<Running> {
|
|||
) -> Result<()> {
|
||||
filter::waku_filter_unsubscribe(filter_subscription, timeout)
|
||||
}
|
||||
|
||||
|
||||
/// Update the bootnodes used by DiscoveryV5 by passing a list of ENRs
|
||||
pub fn discv5_update_bootnodes(
|
||||
bootnodes: Vec<String>
|
||||
) -> Result<()> {
|
||||
discovery::waku_discv5_update_bootnodes(bootnodes)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Spawn a new Waku node with the given configuration (default configuration if `None` provided)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-rc.3"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Daniel Sanchez Quiros <danielsq@status.im>"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d9a12bf079a8bbb59ab1df591062b9bb91d3804d
|
||||
Subproject commit f6fe353e2ee31bd5514811327cb1ca2478e2e4a9
|
Loading…
Reference in New Issue