#tokio #lightning #connection #wish #sockets #tcp-stream #reference

lightning-net-tokio

Implementation of the rust-lightning network stack using Tokio. For Rust-Lightning clients which wish to make direct connections to Lightning P2P nodes, this is a simple alternative to implementing the required network stack, especially for those already using Tokio

45 releases

0.1.0 Jan 16, 2025
0.1.0-beta1 Dec 22, 2024
0.0.125 Oct 14, 2024
0.0.123 May 9, 2024
0.0.1 Jun 1, 2019

#5 in #wish

Download history 2210/week @ 2024-10-23 2685/week @ 2024-10-30 2689/week @ 2024-11-06 2105/week @ 2024-11-13 1819/week @ 2024-11-20 1942/week @ 2024-11-27 2066/week @ 2024-12-04 2350/week @ 2024-12-11 1296/week @ 2024-12-18 850/week @ 2024-12-25 1344/week @ 2025-01-01 1551/week @ 2025-01-08 2596/week @ 2025-01-15 2233/week @ 2025-01-22 2102/week @ 2025-01-29 2275/week @ 2025-02-05

9,603 downloads per month
Used in 10 crates (4 directly)

MIT/Apache

7.5MB
121K SLoC

A socket handling library for those running in Tokio environments who wish to use rust-lightning with native TcpStreams.

Designed to be as simple as possible, the high-level usage is almost as simple as "hand over a TcpStream and a reference to a PeerManager and the rest is handled".

The PeerManager, due to the fire-and-forget nature of this logic, must be a reference, (e.g. an [Arc]) and must use the SocketDescriptor provided here as the PeerManager's SocketDescriptor implementation.

Three methods are exposed to register a new connection for handling in tokio::spawn calls; see their individual docs for details.

Dependencies

~12–20MB
~215K SLoC