Skip to content

Commit

Permalink
feat: port webrtc feature change from maintain/0.11 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Aug 19, 2024
1 parent 2d964c5 commit 1a6d2c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- refactor: Reference `Block` in `BlockStore::put_block`. [PR 272](https://github.com/dariusc93/rust-ipfs/pull/272)
- feat: Passthrough timeout to WantSession::new. [PR 265](https://github.com/dariusc93/rust-ipfs/pull/265)

# 0.11.21
- chore: Put libp2p-webrtc-websys behind feature.

# 0.11.20
- feat: Add Ipfs::{add,remove}_external_address.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ name = "rust-ipfs"
readme = "README.md"
repository = "https://github.com/dariusc93/rust-ipfs"
description = "IPFS node implementation"
version = "0.11.20"
version = "0.11.21"

[features]
default = []

experimental_stream = ["dep:libp2p-stream"]

webrtc_transport = ["dep:libp2p-webrtc"]
webrtc_transport = ["dep:libp2p-webrtc", "dep:libp2p-webrtc-websys"]

sled_data_store = ["dep:sled"]
redb_data_store = ["dep:redb"]
Expand Down Expand Up @@ -162,7 +162,7 @@ futures-timer = { workspace = true, features = ["wasm-bindgen"] }
getrandom = { workspace = true, features = ["js"] }
idb.workspace = true
libp2p = { features = ["gossipsub", "autonat", "relay", "dcutr", "identify", "kad", "websocket-websys", "webtransport-websys", "macros", "noise", "ping", "yamux", "dns", "ed25519", "secp256k1", "ecdsa", "serde", "request-response", "json", "cbor", "rendezvous", "wasm-bindgen", ], workspace = true }
libp2p-webrtc-websys.workspace = true
libp2p-webrtc-websys = { workspace = true, optional = true }
send_wrapper.workspace = true
serde-wasm-bindgen.workspace = true
tokio = { default-features = false, features = ["sync", "macros"], workspace = true }
Expand Down
8 changes: 8 additions & 0 deletions src/p2p/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ pub(crate) fn build_transport(
) -> io::Result<TTransport> {
use libp2p::websocket_websys;
use libp2p::webtransport_websys;

#[cfg(feature = "webrtc_transport")]
use libp2p_webrtc_websys as webrtc_websys;

let noise_config = noise::Config::new(&keypair).map_err(io::Error::other)?;
Expand Down Expand Up @@ -338,6 +340,7 @@ pub(crate) fn build_transport(
false => transport.boxed(),
};

#[cfg(feature = "webrtc_transport")]
let transport = match enable_webrtc {
true => {
let wrtc_transport =
Expand All @@ -353,6 +356,11 @@ pub(crate) fn build_transport(
false => transport,
};

#[cfg(not(feature = "webrtc_transport"))]
{
_ = enable_webrtc;
}

Ok(transport)
}

Expand Down

0 comments on commit 1a6d2c3

Please sign in to comment.