Pierre Krieger 68299c40a5 Implement Kademlia peer discovery (#120)
* Impl Clone for SwarmController and remove 'static

* Implement Kademlia

* Implement ConnectionReuse correctly

* Implement ConnectionReuse correctly

* Add some tests and fixes

* Remove useless boolean in active_connections

* Correctly run tests

* Optimize the processing

* Rustfmt on libp2p-kad

* Improve Kademlia example

* Next incoming is now in two steps

* Some work

* Remove log

* Fix dialing a node even if we already have a connection

* Add a proper PeerId to Peerstore

* Turn identify into a transport layer

* Expose the dialed multiaddress

* Add identified nodes to the peerstore

* Allow configuring the TTL of the addresses

* Split identify in two modules

* Some comments and tweaks

* Run rustfmt

* More work

* Add test and bugfix

* Fix everything

* Start transition to new identify system

* More work

* Minor style

* Start implementation of Kademlia server upgrade

* Continue implementing the Kademlia server

* Start reimplementing high-level kademlia code

* Continue reimplementing high-level code

* More work

* More work

* More work

* Fix wrong address reported when dialing

* Make it work

* Remove cluster_level field everywhere

* Fix bug in varint-rs when encoding

* More work

* More work

* More work

* More work

* More work

* Bugfix

* More work

* Implement ping

* Style in kademlia_handler

* More work

* Better error handling in query.rs

* More work

* More work

* More work

* Debug impls

* Some cleanup in swarm

* More work

* Clean up changes in swarm

* Unpublish the kbucket module

* Fix examples and some warnings

* Fix websocket browser code

* Rustfmt on libp2p-kad

* Kad initialization process

* Add logging to the example

* Fix concerns

* Fix style
2018-03-15 15:18:21 +01:00
2018-03-07 16:20:55 +01:00
2018-03-07 16:20:55 +01:00
2018-03-07 16:20:55 +01:00
2018-03-07 16:20:55 +01:00
2017-09-18 16:52:27 +02:00
2017-11-08 13:03:59 +01:00
2018-01-23 19:21:41 +01:00

[WIP] Central repository for work on libp2p

This repository is the central place for rust development of the libp2p 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.

General overview of the architecture

Architecture of the crates of this repository:

  • datastore: Utility library whose API provides a key-value storage with multiple possible backends. Used by peerstore.
  • example: Example usages of this library.
  • libp2p-identify: Protocol implementation that allows a node A to query another node B what information B knows about A. Implements the ConnectionUpgrade trait of libp2p-swarm.
  • 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. Used by libp2p-swarm.
  • libp2p-ping: Implementation of the ping protocol (the exact protocol is specific to libp2p). Implements the ConnectionUpgrade trait of libp2p-swarm.
  • libp2p-secio: Implementation of the secio protocol. Encrypts communications. Implements the ConnectionUpgrade trait of libp2p-swarm.
  • libp2p-swarm: Core library that contains all the traits of libp2p and plugs things together.
  • libp2p-tcp-transport: Implementation of the Transport trait of libp2p-swarm for TCP/IP.
  • libp2p-websocket: Implementation of the Transport trait of libp2p-swarm for Websockets.
  • 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.
  • rw-stream-sink: Utility library that makes it possible to wrap around a tokio Stream + Sink of bytes and implements AsyncRead + AsyncWrite.

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.

Once this syntax is stable in the nightly version, we will consider requiring the nightly version of the compiler and switching to this syntax.

Description
No description provided
Readme MIT 23 MiB
Languages
Rust 99.8%
JavaScript 0.2%