-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: libp2p relay and gossipsub server (#1459)
* feat: start writing libp2p server * feat: working libp2p example * feat: relay server * feat: basic chat room server * feat(server): relay & gossipsub for sending messages in topics (rooms) * feat: set up server in torii-server and satrt working on client * feat(client): implemented ping & identify and sending messages to topic * ferat: stasrt integrating into torii-client & message channel * feat: integration into torii-client & error handling * feat: tests for libp2p server & client and finish integration * chore: tests * chore: webrtc base * fix: server webrtc correctly compiling & use tokio * chore: tests * feat: client compiling for wasm * chore: fmt & clippy * chore: update cargo.lock * chore: rebase main branch * fix: deps * feat: wasm tests for client connectivity * feat: specify port in torii cli and cert/local key for libp2p * chore: clippy & fmt * feat(client): event loop * feat(client): add quic support * fix: issue with ping timeout * chore: clippy and fmt * refactor: review changes * chore: change to torii-relay * chore: fmt * refactor: use unbounded channel for messages & commands * chore: remove unused imports * chore: clippy torii client * feat: expose full message metadata * chore: prefix cli args with relay * feat: oneshot channel for commands result and expose mesages on torii client * refactor(server): better error handling & type scopes
- Loading branch information
Showing
17 changed files
with
3,047 additions
and
170 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
edition.workspace = true | ||
license-file.workspace = true | ||
name = "torii-relay" | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
futures.workspace = true | ||
rand = "0.8.5" | ||
serde.workspace = true | ||
serde_json.workspace = true | ||
thiserror.workspace = true | ||
tracing-subscriber = { version = "0.3", features = ["env-filter"] } | ||
tracing.workspace = true | ||
async-trait = "0.1.77" | ||
regex = "1.10.3" | ||
anyhow.workspace = true | ||
|
||
[dev-dependencies] | ||
tempfile = "3.9.0" | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
tokio.workspace = true | ||
libp2p = { git = "https://github.com/libp2p/rust-libp2p", features = [ "ed25519", "gossipsub", "identify", "macros", "noise", "ping", "quic", "relay", "tcp", "tokio", "yamux" ] } | ||
libp2p-webrtc = { git = "https://github.com/libp2p/rust-libp2p", features = [ "tokio", "pem" ] } | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
libp2p = { git = "https://github.com/libp2p/rust-libp2p", features = [ "ed25519", "gossipsub", "identify", "macros", "ping", "tcp", "wasm-bindgen" ] } | ||
libp2p-webrtc-websys = { git = "https://github.com/libp2p/rust-libp2p" } | ||
tracing-wasm = "0.2.1" | ||
wasm-bindgen-test = "0.3.40" | ||
wasm-bindgen-futures = "0.4.40" | ||
wasm-timer = "0.2.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use gossipsub::Event as GossipsubEvent; | ||
use libp2p::{gossipsub, identify, ping}; | ||
|
||
#[derive(Debug)] | ||
pub(crate) enum ClientEvent { | ||
Gossipsub(GossipsubEvent), | ||
Identify(identify::Event), | ||
Ping(ping::Event), | ||
} | ||
|
||
impl From<GossipsubEvent> for ClientEvent { | ||
fn from(event: GossipsubEvent) -> Self { | ||
Self::Gossipsub(event) | ||
} | ||
} | ||
|
||
impl From<identify::Event> for ClientEvent { | ||
fn from(event: identify::Event) -> Self { | ||
Self::Identify(event) | ||
} | ||
} | ||
|
||
impl From<ping::Event> for ClientEvent { | ||
fn from(event: ping::Event) -> Self { | ||
Self::Ping(event) | ||
} | ||
} |
Oops, something went wrong.