Rework libp2p-identify (#116)

* 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

* Add test and bugfix

* Fix wrong address reported when dialing

* Fix websocket browser code

* Support the p2p protocol in libp2p-identify

* Fix concerns

* Fix libp2p-dns

* More concerns
This commit is contained in:
Pierre Krieger
2018-03-07 10:49:11 +01:00
committed by GitHub
parent 3b859b6833
commit 39dde305b4
22 changed files with 894 additions and 313 deletions

View File

@@ -53,7 +53,7 @@ fn client_to_server_outbound() {
let future = listener
.into_future()
.map_err(|(err, _)| err)
.and_then(|(client, _)| client.unwrap().0)
.and_then(|(client, _)| client.unwrap().map(|v| v.0))
.and_then(|client| client.outbound())
.map(|client| Framed::<_, bytes::BytesMut>::new(client))
.and_then(|client| {
@@ -75,7 +75,7 @@ fn client_to_server_outbound() {
.with_upgrade(multiplex::MultiplexConfig);
let future = transport.dial(rx.recv().unwrap()).unwrap()
.and_then(|client| client.inbound())
.and_then(|client| client.0.inbound())
.map(|server| Framed::<_, bytes::BytesMut>::new(server))
.and_then(|server| server.send("hello world".into()))
.map(|_| ());
@@ -102,7 +102,7 @@ fn client_to_server_inbound() {
let future = listener
.into_future()
.map_err(|(err, _)| err)
.and_then(|(client, _)| client.unwrap().0)
.and_then(|(client, _)| client.unwrap().map(|v| v.0))
.and_then(|client| client.inbound())
.map(|client| Framed::<_, bytes::BytesMut>::new(client))
.and_then(|client| {
@@ -124,7 +124,7 @@ fn client_to_server_inbound() {
.with_upgrade(multiplex::MultiplexConfig);
let future = transport.dial(rx.recv().unwrap()).unwrap()
.and_then(|client| client.outbound())
.and_then(|(client, _)| client.outbound())
.map(|server| Framed::<_, bytes::BytesMut>::new(server))
.and_then(|server| server.send("hello world".into()))
.map(|_| ());