mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 15:21:33 +00:00
chore(gossipsub): include in libp2p
meta crate when compiling for wasm
Since https://github.com/libp2p/rust-libp2p/pull/3973, gossipsub now fully supports wasm targets. It functions properly when added as a dependency on its own. However, when trying to use it under libp2p by activating a feature, it's not possible and the compiler will raise an error like `unresolved import libp2p::gossipsub`. This pull request enables the use of gossipsub for wasm targets when it's activated as a feature of the libp2p dependency. Pull-Request: #4217.
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2498,7 +2498,7 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libp2p"
|
name = "libp2p"
|
||||||
version = "0.52.1"
|
version = "0.52.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2858,7 +2858,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libp2p-metrics"
|
name = "libp2p-metrics"
|
||||||
version = "0.13.0"
|
version = "0.13.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
"libp2p-core",
|
"libp2p-core",
|
||||||
|
@ -75,7 +75,7 @@ libp2p-identify = { version = "0.43.0", path = "protocols/identify" }
|
|||||||
libp2p-identity = { version = "0.2.1" }
|
libp2p-identity = { version = "0.2.1" }
|
||||||
libp2p-kad = { version = "0.44.2", path = "protocols/kad" }
|
libp2p-kad = { version = "0.44.2", path = "protocols/kad" }
|
||||||
libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" }
|
libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" }
|
||||||
libp2p-metrics = { version = "0.13.0", path = "misc/metrics" }
|
libp2p-metrics = { version = "0.13.1", path = "misc/metrics" }
|
||||||
libp2p-mplex = { version = "0.40.0", path = "muxers/mplex" }
|
libp2p-mplex = { version = "0.40.0", path = "muxers/mplex" }
|
||||||
libp2p-muxer-test-harness = { path = "muxers/test-harness" }
|
libp2p-muxer-test-harness = { path = "muxers/test-harness" }
|
||||||
libp2p-noise = { version = "0.43.0", path = "transports/noise" }
|
libp2p-noise = { version = "0.43.0", path = "transports/noise" }
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
## 0.52.2 - unreleased
|
||||||
|
|
||||||
|
- Include gossipsub when compiling for wasm.
|
||||||
|
See [PR 4217].
|
||||||
|
|
||||||
|
[PR 4217]: https://github.com/libp2p/rust-libp2p/pull/4217
|
||||||
|
|
||||||
## 0.52.1
|
## 0.52.1
|
||||||
|
|
||||||
- Add `libp2p-webtransport-websys` providing WebTransport for WASM environments.
|
- Add `libp2p-webtransport-websys` providing WebTransport for WASM environments.
|
||||||
|
@ -3,7 +3,7 @@ name = "libp2p"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.65.0"
|
rust-version = "1.65.0"
|
||||||
description = "Peer-to-peer networking library"
|
description = "Peer-to-peer networking library"
|
||||||
version = "0.52.1"
|
version = "0.52.2"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
|
@ -65,7 +65,6 @@ pub use libp2p_dns as dns;
|
|||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use libp2p_floodsub as floodsub;
|
pub use libp2p_floodsub as floodsub;
|
||||||
#[cfg(feature = "gossipsub")]
|
#[cfg(feature = "gossipsub")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use libp2p_gossipsub as gossipsub;
|
pub use libp2p_gossipsub as gossipsub;
|
||||||
#[cfg(feature = "identify")]
|
#[cfg(feature = "identify")]
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
## 0.13.1 - unreleased
|
||||||
|
|
||||||
|
- Enable gossipsub related data-type fields when compiling for wasm.
|
||||||
|
See [PR 4217].
|
||||||
|
|
||||||
|
[PR 4217]: https://github.com/libp2p/rust-libp2p/pull/4217
|
||||||
|
|
||||||
## 0.13.0
|
## 0.13.0
|
||||||
|
|
||||||
- Previously `libp2p-metrics::identify` would increase a counter / gauge / histogram on each
|
- Previously `libp2p-metrics::identify` would increase a counter / gauge / histogram on each
|
||||||
|
@ -3,7 +3,7 @@ name = "libp2p-metrics"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.65.0"
|
rust-version = "1.65.0"
|
||||||
description = "Metrics for libp2p"
|
description = "Metrics for libp2p"
|
||||||
version = "0.13.0"
|
version = "0.13.1"
|
||||||
authors = ["Max Inden <mail@max-inden.de>"]
|
authors = ["Max Inden <mail@max-inden.de>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,32 +11,30 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
dcutr = ["libp2p-dcutr"]
|
||||||
gossipsub = ["libp2p-gossipsub"]
|
gossipsub = ["libp2p-gossipsub"]
|
||||||
identify = ["libp2p-identify"]
|
identify = ["libp2p-identify"]
|
||||||
kad = ["libp2p-kad"]
|
kad = ["libp2p-kad"]
|
||||||
ping = ["libp2p-ping"]
|
ping = ["libp2p-ping"]
|
||||||
relay = ["libp2p-relay"]
|
relay = ["libp2p-relay"]
|
||||||
dcutr = ["libp2p-dcutr"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
instant = "0.1.12"
|
instant = "0.1.12"
|
||||||
libp2p-core = { workspace = true }
|
libp2p-core = { workspace = true }
|
||||||
libp2p-dcutr = { workspace = true, optional = true }
|
libp2p-dcutr = { workspace = true, optional = true }
|
||||||
|
libp2p-gossipsub = { workspace = true, optional = true }
|
||||||
libp2p-identify = { workspace = true, optional = true }
|
libp2p-identify = { workspace = true, optional = true }
|
||||||
|
libp2p-identity = { workspace = true }
|
||||||
libp2p-kad = { workspace = true, optional = true }
|
libp2p-kad = { workspace = true, optional = true }
|
||||||
libp2p-ping = { workspace = true, optional = true }
|
libp2p-ping = { workspace = true, optional = true }
|
||||||
libp2p-relay = { workspace = true, optional = true }
|
libp2p-relay = { workspace = true, optional = true }
|
||||||
libp2p-swarm = { workspace = true }
|
libp2p-swarm = { workspace = true }
|
||||||
libp2p-identity = { workspace = true }
|
|
||||||
prometheus-client = { version = "0.21.2"}
|
|
||||||
once_cell = "1.18.0"
|
once_cell = "1.18.0"
|
||||||
|
prometheus-client = { version = "0.21.2"}
|
||||||
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
|
||||||
libp2p-gossipsub = { workspace = true, optional = true }
|
|
||||||
|
|
||||||
# Passing arguments to the docsrs builder in order to properly document cfg's.
|
# Passing arguments to the docsrs builder in order to properly document cfg's.
|
||||||
# More information: https://docs.rs/about/builds#cross-compiling
|
# More information: https://docs.rs/about/builds#cross-compiling
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
rustc-args = ["--cfg", "docsrs"]
|
rustc-args = ["--cfg", "docsrs"]
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
@ -64,7 +64,6 @@ const ALLOWED_PROTOCOLS: &[StreamProtocol] = &[
|
|||||||
#[cfg(feature = "dcutr")]
|
#[cfg(feature = "dcutr")]
|
||||||
libp2p_dcutr::PROTOCOL_NAME,
|
libp2p_dcutr::PROTOCOL_NAME,
|
||||||
// #[cfg(feature = "gossipsub")]
|
// #[cfg(feature = "gossipsub")]
|
||||||
// #[cfg(not(target_os = "unknown"))]
|
|
||||||
// TODO: Add Gossipsub protocol name
|
// TODO: Add Gossipsub protocol name
|
||||||
libp2p_identify::PROTOCOL_NAME,
|
libp2p_identify::PROTOCOL_NAME,
|
||||||
libp2p_identify::PUSH_PROTOCOL_NAME,
|
libp2p_identify::PUSH_PROTOCOL_NAME,
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#[cfg(feature = "dcutr")]
|
#[cfg(feature = "dcutr")]
|
||||||
mod dcutr;
|
mod dcutr;
|
||||||
#[cfg(feature = "gossipsub")]
|
#[cfg(feature = "gossipsub")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
mod gossipsub;
|
mod gossipsub;
|
||||||
#[cfg(feature = "identify")]
|
#[cfg(feature = "identify")]
|
||||||
mod identify;
|
mod identify;
|
||||||
@ -50,7 +49,6 @@ pub struct Metrics {
|
|||||||
#[cfg(feature = "dcutr")]
|
#[cfg(feature = "dcutr")]
|
||||||
dcutr: dcutr::Metrics,
|
dcutr: dcutr::Metrics,
|
||||||
#[cfg(feature = "gossipsub")]
|
#[cfg(feature = "gossipsub")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
gossipsub: gossipsub::Metrics,
|
gossipsub: gossipsub::Metrics,
|
||||||
#[cfg(feature = "identify")]
|
#[cfg(feature = "identify")]
|
||||||
identify: identify::Metrics,
|
identify: identify::Metrics,
|
||||||
@ -78,7 +76,6 @@ impl Metrics {
|
|||||||
#[cfg(feature = "dcutr")]
|
#[cfg(feature = "dcutr")]
|
||||||
dcutr: dcutr::Metrics::new(sub_registry),
|
dcutr: dcutr::Metrics::new(sub_registry),
|
||||||
#[cfg(feature = "gossipsub")]
|
#[cfg(feature = "gossipsub")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
gossipsub: gossipsub::Metrics::new(sub_registry),
|
gossipsub: gossipsub::Metrics::new(sub_registry),
|
||||||
#[cfg(feature = "identify")]
|
#[cfg(feature = "identify")]
|
||||||
identify: identify::Metrics::new(sub_registry),
|
identify: identify::Metrics::new(sub_registry),
|
||||||
@ -107,7 +104,6 @@ impl Recorder<libp2p_dcutr::Event> for Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gossipsub")]
|
#[cfg(feature = "gossipsub")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
impl Recorder<libp2p_gossipsub::Event> for Metrics {
|
impl Recorder<libp2p_gossipsub::Event> for Metrics {
|
||||||
fn record(&self, event: &libp2p_gossipsub::Event) {
|
fn record(&self, event: &libp2p_gossipsub::Event) {
|
||||||
self.gossipsub.record(event)
|
self.gossipsub.record(event)
|
||||||
|
Reference in New Issue
Block a user