Skip to content

DougAnderson444/libp2peasy

Repository files navigation

Libp2peasy, Lemon Squeezy 🍋✊

Ready made Libp2p Rust Server that connects to the IPFS DHT and gossipsib.

Design goal is to have all modules separated for easy re-use in other libraries, and yto use a plugin system to extend the functionality of the server as you need it.

Run Binary

From this package root run:

cargo run

Build Your Own

let _join_handle = tokio::spawn(async {
        let _res = Libp2peasy::new()
            .enable_kademlia(StreamProtocol::new("my-network/1.0.0"))
            .enable_gossipsub()
            // todo: with_plugin(&plugin)
            .start_with_tokio_executor(recvr)
            .await;
    });

Tests

cargo test --workspace

Plugins

Libp2peasy doesn't do much on its own except connect with peers and propagate messages. But, it is designed to be extended with plugins. Each plugin will have an emitter and handler built into it to transmit and receive messages throught libp2peasy.

More to come as dev continues...

Hacks & Notes

The server sends a hearbeat message every 15 seconds to the browsers, because Libp2p-WebRTC is still in alpha and gets disconnected after inactivity.

WebRTC is used instead of WebTransport as WebTransport is not yet supported in rust-libp2p.

AutoNat doesn't seem to play well when connected to WebRTC transported browsers, so it is not enabled.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages