diff options
| author | tv <tv@krebsco.de> | 2026-10-27 02:22:24 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-27 02:22:24 +0100 |
| commit | d1926800dfdbfba213a0b5060777055d8b1dbae4 (patch) | |
| tree | 90193cc6589200d2d6363bebd183dbb96ee90698 /src/main.rs | |
| parent | ab0a8f5782d11a264a63f2fc1c2ffa292759df4e (diff) | |
add libp2p transport
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 435f83a..3ab51d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -176,6 +176,29 @@ async fn main() -> Result<()> { Arc::new(mycelium::MyceliumTransport::connect(setup).await?), ) } + #[cfg(feature = "libp2p")] + "libp2p" => { + let listen = args + .libp2p_listen + .iter() + .map(|address| { + address + .parse::<libp2p::Multiaddr>() + .with_context(|| format!("libp2p-listen {address:?}")) + }) + .collect::<Result<Vec<_>>>()?; + let key = transport::p2p::Libp2pConfig::load_key(args.libp2p_key_file.as_deref())?; + ( + "libp2p", + Arc::new(transport::p2p::Libp2pTransport::start( + transport::p2p::Libp2pConfig { + key, + listen, + memory: false, + }, + )?), + ) + } other => anyhow::bail!("transports: no {other} in this build"), }; debug!( |
