2017-11-08 13:03:59 +01:00
|
|
|
# [WIP] Central repository for work on libp2p
|
|
|
|
|
|
|
|
This repository is the central place for rust development of the
|
|
|
|
[libp2p](https://libp2p.io) spec.
|
|
|
|
|
|
|
|
This readme along with many others will be more fleshed out the closer
|
|
|
|
the project gets to completion. Right now everything including the crate
|
|
|
|
organization is very much Work in Progress.
|
2017-11-17 15:38:53 +01:00
|
|
|
|
2018-05-18 14:56:11 +02:00
|
|
|
## The main crate: libp2p
|
|
|
|
|
|
|
|
This repository includes a facade crate named `libp2p`, which reexports the rest of the repository.
|
|
|
|
|
2017-11-17 15:38:53 +01:00
|
|
|
## General overview of the architecture
|
|
|
|
|
2018-05-18 14:56:11 +02:00
|
|
|
Architecture of the other crates of this repository:
|
2017-11-17 15:38:53 +01:00
|
|
|
|
|
|
|
- `datastore`: Utility library whose API provides a key-value storage with multiple possible
|
2017-11-20 10:34:56 +01:00
|
|
|
backends. Used by `peerstore`.
|
2017-11-02 11:58:02 +01:00
|
|
|
- `example`: Example usages of this library.
|
2017-12-13 12:08:40 +01:00
|
|
|
- `libp2p-identify`: Protocol implementation that allows a node A to query another node B what
|
2018-05-16 12:59:36 +02:00
|
|
|
information B knows about A. Implements the `ConnectionUpgrade` trait of `libp2p-core`.
|
2017-11-20 10:34:56 +01:00
|
|
|
- `libp2p-peerstore`: Generic storage for information about remote peers (their multiaddresses and
|
|
|
|
their public key), with multiple possible backends. Each multiaddress also has a time-to-live.
|
2018-05-16 12:59:36 +02:00
|
|
|
Used by `libp2p-core`.
|
2017-11-22 10:58:06 +01:00
|
|
|
- `libp2p-ping`: Implementation of the `ping` protocol (the exact protocol is specific to libp2p).
|
2018-05-16 12:59:36 +02:00
|
|
|
Implements the `ConnectionUpgrade` trait of `libp2p-core`.
|
2017-11-02 11:58:02 +01:00
|
|
|
- `libp2p-secio`: Implementation of the `secio` protocol. Encrypts communications. Implements the
|
2018-05-16 12:59:36 +02:00
|
|
|
`ConnectionUpgrade` trait of `libp2p-core`.
|
|
|
|
- `libp2p-core`: Core library that contains all the traits of *libp2p* and plugs things together.
|
|
|
|
- `libp2p-tcp-transport`: Implementation of the `Transport` trait of `libp2p-core` for TCP/IP.
|
|
|
|
- `libp2p-websocket`: Implementation of the `Transport` trait of `libp2p-core` for Websockets.
|
2017-11-17 15:38:53 +01:00
|
|
|
- `multistream-select`: Implementation of the `multistream-select` protocol, which is used to
|
|
|
|
negotiate a protocol over a newly-established connection with a peer, or after a connection
|
|
|
|
upgrade.
|
2017-11-08 14:51:51 +01:00
|
|
|
- `rw-stream-sink`: Utility library that makes it possible to wrap around a tokio `Stream + Sink`
|
|
|
|
of bytes and implements `AsyncRead + AsyncWrite`.
|
2018-01-03 17:46:52 +01:00
|
|
|
|
|
|
|
## About the `impl Trait` syntax
|
|
|
|
|
|
|
|
Right now a lot of code of this library uses `Box<Future>` or `Box<Stream>` objects, or forces
|
|
|
|
`'static` lifetime bounds.
|
|
|
|
|
|
|
|
This is caused by the lack of a stable `impl Trait` syntax in the Rust language. Once this syntax
|
|
|
|
is fully implemented and stabilized, it will be possible to change this code to use plain and
|
|
|
|
non-static objects instead of boxes.
|
|
|
|
|
|
|
|
Progress for the `impl Trait` syntax can be tracked in [this issue of the Rust repository](https://github.com/rust-lang/rust/issues/34511).
|
|
|
|
|
|
|
|
Once this syntax is stable in the nightly version, we will consider requiring the nightly version
|
|
|
|
of the compiler and switching to this syntax.
|
2018-01-23 19:21:41 +01:00
|
|
|
|