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", except for the Event handlng mechanism, see below.
The PeerHandler, due to the fire-and-forget nature of this logic, must be an Arc, and must use the SocketDescriptor provided here as the PeerHandler's SocketDescriptor.
Three methods are exposed to register a new connection for handling in tokio::spawn calls, see their individual docs for more. All three take a mpsc::Sender<()> which is sent into every time something occurs which may result in lightning Events. The call site should, thus, look something like this:
use mpsc;
use TcpStream;
use PublicKey;
use EventsProvider;
use SocketAddr;
use Arc;
// Define concrete types for our high-level objects:
type TxBroadcaster = dyn BroadcasterInterface;
type FeeEstimator = dyn FeeEstimator;
type ChannelMonitor = SimpleManyChannelMonitor;
type ChannelManager = SimpleArcChannelManager;
type PeerManager = SimpleArcPeerManager;
// Connect to node with pubkey their_node_id at addr:
async
// Begin reading from a newly accepted socket and talk to the peer:
async