Skip to content

Commit 077eaff

Browse files
committed
feat(p2p/native): add datachannel-rs backend
1 parent 4ab2285 commit 077eaff

File tree

7 files changed

+578
-109
lines changed

7 files changed

+578
-109
lines changed

Cargo.lock

Lines changed: 144 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/channels.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub use tokio::sync::{broadcast, mpsc, oneshot};
1+
pub use tokio::sync::{broadcast, mpsc, oneshot, watch};

node/native/src/node/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ impl NodeBuilder {
291291
}
292292

293293
pub fn build(mut self) -> anyhow::Result<Node> {
294-
let p2p_sec_key = self.p2p_sec_key.unwrap_or_else(P2pSecretKey::rand);
294+
let p2p_sec_key = self.p2p_sec_key.clone().unwrap_or_else(P2pSecretKey::rand);
295+
self.p2p_sec_key(p2p_sec_key.clone());
295296
if self.p2p.initial_peers.is_empty() && !self.p2p_is_seed {
296297
self.p2p.initial_peers = default_peers();
297298
}

p2p/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ p2p-testing = { path = "testing" }
6969
redux = { workspace = true, features=["serializable_callbacks"] }
7070
tokio = { version = "1.26", features = ["rt"] }
7171
webrtc = { git = "https://github.com/openmina/webrtc.git", rev = "e8705db39af1b198b324a5db6ff57fb213ba75e9", optional = true }
72+
datachannel = { git = "https://github.com/openmina/datachannel-rs.git", rev = "1bfb064d0ff3e54a93ae0288409902aab8d102d3", optional = true }
7273
reqwest = { version = "0.11", features = ["json"] }
7374
mio = { version = "0.8.11", features = ["os-poll", "net"] }
7475
libc = { version = "0.2.151" }
@@ -85,6 +86,8 @@ tokio = { version = "1.26", features = ["macros"] }
8586
getrandom = { version = "0.2", features = ["js"] }
8687

8788
[features]
88-
p2p-webrtc = ["webrtc"]
89+
p2p-webrtc = ["p2p-webrtc-cpp"]
90+
p2p-webrtc-rs = ["webrtc"]
91+
p2p-webrtc-cpp = ["datachannel"]
8992
p2p-libp2p = ["fuzzing", "dep:reqwest", "dep:faster-stun"]
9093
fuzzing = ["openmina-fuzzer", "openmina-core/fuzzing"]

0 commit comments

Comments
 (0)