Skip to content

Commit

Permalink
pass peers to relay
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Mar 5, 2025
1 parent 4b5306d commit 5fc639e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions crates/torii/libp2p/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ impl<P: Provider + Sync> Relay<P> {
port_websocket: u16,
local_key_path: Option<String>,
cert_path: Option<String>,
) -> Result<Self, Error> {
Self::new_with_peers(pool, provider, port, port_webrtc, port_websocket, local_key_path, cert_path, vec![])
}

pub fn new_with_peers(
pool: Sql,
provider: P,
port: u16,
port_webrtc: u16,
port_websocket: u16,
local_key_path: Option<String>,
cert_path: Option<String>,
peers: Vec<String>,
) -> Result<Self, Error> {
let local_key = if let Some(path) = local_key_path {
Expand Down
3 changes: 2 additions & 1 deletion crates/torii/runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ impl Runner {
)
.await?;

let mut libp2p_relay_server = torii_relay::server::Relay::new(
let mut libp2p_relay_server = torii_relay::server::Relay::new_with_peers(
db,
provider.clone(),
self.args.relay.port,
self.args.relay.webrtc_port,
self.args.relay.websocket_port,
self.args.relay.local_key_path,
self.args.relay.cert_path,
self.args.relay.peers,
)
.expect("Failed to start libp2p relay server");

Expand Down

0 comments on commit 5fc639e

Please sign in to comment.