Fix the networking (#364)

* Serve only non-empty Kademlia nodes

* Use the number of custom protos to determine whether to open more

* Add timeout when connecting

* Connect to random peers from the peer store

* Various adjustements

* Typo

* Explicitely connect to bootnodes

* Fix potential overflow
This commit is contained in:
Pierre Krieger
2018-07-18 13:55:38 +02:00
committed by Gav Wood
parent 73613f45c1
commit de168ca034
5 changed files with 271 additions and 167 deletions
+108 -108
View File
@@ -252,17 +252,17 @@ dependencies = [
[[package]]
name = "cid"
version = "0.2.3"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"integer-encoding 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "circular-buffer"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"smallvec 0.6.0 (git+https://github.com/Vurich/rust-smallvec.git?branch=array-zero)",
]
@@ -409,7 +409,7 @@ dependencies = [
[[package]]
name = "datastore"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"base64 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chashmap 2.2.1 (git+https://github.com/redox-os/tfs)",
@@ -1148,26 +1148,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libp2p"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1177,16 +1177,16 @@ dependencies = [
[[package]]
name = "libp2p-core"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bs58 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 1.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1197,12 +1197,12 @@ dependencies = [
[[package]]
name = "libp2p-dns"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"tokio-dns-unofficial 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1210,98 +1210,98 @@ dependencies = [
[[package]]
name = "libp2p-floodsub"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bs58 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "libp2p-identify"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen-pure 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "libp2p-kad"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"bigint 4.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bs58 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "libp2p-mplex"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"circular-buffer 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"circular-buffer 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-mutex 0.3.0 (git+https://github.com/paritytech/futures-mutex)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "libp2p-peerstore"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bs58 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1310,14 +1310,14 @@ dependencies = [
[[package]]
name = "libp2p-ping"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1326,11 +1326,11 @@ dependencies = [
[[package]]
name = "libp2p-ratelimit"
version = "0.1.1"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"aio-limited 0.1.0 (git+https://github.com/paritytech/aio-limited.git)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1339,37 +1339,37 @@ dependencies = [
[[package]]
name = "libp2p-relay"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"protobuf 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
name = "libp2p-secio"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"asn1_der 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen-pure 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1377,12 +1377,12 @@ dependencies = [
[[package]]
name = "libp2p-tcp-transport"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1390,10 +1390,10 @@ dependencies = [
[[package]]
name = "libp2p-transport-timeout"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1401,13 +1401,13 @@ dependencies = [
[[package]]
name = "libp2p-websocket"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"websocket 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1416,11 +1416,11 @@ dependencies = [
[[package]]
name = "libp2p-yamux"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"yamux 0.1.0 (git+https://github.com/paritytech/yamux)",
@@ -1556,10 +1556,10 @@ dependencies = [
[[package]]
name = "multiaddr"
version = "0.3.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cid 0.2.3 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"cid 0.2.3 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"integer-encoding 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1574,7 +1574,7 @@ dependencies = [
[[package]]
name = "multihash"
version = "0.8.1-pre"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"sha1 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1584,14 +1584,14 @@ dependencies = [
[[package]]
name = "multistream-select"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
]
[[package]]
@@ -2377,7 +2377,7 @@ dependencies = [
[[package]]
name = "rw-stream-sink"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2807,7 +2807,7 @@ dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)",
"libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)",
"libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3690,7 +3690,7 @@ dependencies = [
[[package]]
name = "varint"
version = "0.1.0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0#2fb5ef1d40f2565e592248abbd21b7ca2da992e0"
source = "git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7#727e0e099b53a4032a7e2330994c819fe866add7"
dependencies = [
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3894,8 +3894,8 @@ dependencies = [
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
"checksum chashmap 2.2.1 (git+https://github.com/redox-os/tfs)" = "<none>"
"checksum chrono 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1cce36c92cb605414e9b824f866f5babe0a0368e39ea07393b9b63cf3844c0e6"
"checksum cid 0.2.3 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum circular-buffer 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum cid 0.2.3 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum circular-buffer 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "95470235c31c726d72bf2e1f421adc1e65b9d561bf5529612cbe1a72da1467b3"
@@ -3912,7 +3912,7 @@ dependencies = [
"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b"
"checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda"
"checksum ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)" = "<none>"
"checksum datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304d19798a8e067e48d8e69b2c37f0b5e9b4e462504ad9e27e9f3fce02bba8"
"checksum digest 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3cae2388d706b52f2f2f9afe280f9d768be36544bd71d1b8120cb34ea6450b55"
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
@@ -3983,22 +3983,22 @@ dependencies = [
"checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739"
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
"checksum libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)" = "ac8ebf8343a981e2fa97042b14768f02ed3e1d602eac06cae6166df3c8ced206"
"checksum libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
"checksum local-encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1ceb20f39ff7ae42f3ff9795f3986b1daad821caaa1e1732a0944103a5a1a66"
"checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54"
@@ -4014,10 +4014,10 @@ dependencies = [
"checksum mime 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0b28683d0b09bbc20be1c9b3f6f24854efb1356ffcffee08ea3f6e65596e85fa"
"checksum mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "6d771e3ef92d58a8da8df7d6976bfca9371ed1de6619d9d5a5ce5b1f29b85bfe"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9c35dac080fd6e16a99924c8dfdef0af89d797dd851adab25feaffacf7850d6"
"checksum multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum nan-preserving-float 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34d4f00fcc2f4c9efa8cc971db0da9e28290e28e97af47585e48691ef10ff31f"
"checksum native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f74dbadc8b43df7864539cedb7bc91345e532fdd913cfdc23ad94f4d2d40fbc0"
"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0"
@@ -4079,7 +4079,7 @@ dependencies = [
"checksum rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)" = "<none>"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a"
"checksum rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
"checksum schannel 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "85fd9df495640643ad2d00443b3d78aae69802ad488debab4f1dd52fc1806ade"
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
@@ -4161,7 +4161,7 @@ dependencies = [
"checksum url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum varint 0.1.0 (git+https://github.com/libp2p/rust-libp2p)" = "<none>"
"checksum varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=2fb5ef1d40f2565e592248abbd21b7ca2da992e0)" = "<none>"
"checksum varint 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=727e0e099b53a4032a7e2330994c819fe866add7)" = "<none>"
"checksum vcpkg 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7ed0f6789c8a85ca41bbc1c9d175422116a9869bd1cf31bb08e1493ecce60380"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
@@ -11,7 +11,7 @@ bytes = "0.4"
error-chain = { version = "0.12", default-features = false }
fnv = "1.0"
futures = "0.1"
libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "2fb5ef1d40f2565e592248abbd21b7ca2da992e0", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "727e0e099b53a4032a7e2330994c819fe866add7", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
ethkey = { git = "https://github.com/paritytech/parity.git" }
ethereum-types = "0.3"
@@ -16,9 +16,9 @@
use bytes::Bytes;
use fnv::{FnvHashMap, FnvHashSet};
use futures::{future, sync::mpsc};
use futures::sync::mpsc;
use libp2p::core::{Multiaddr, AddrComponent, Endpoint, UniqueConnec};
use libp2p::core::{PeerId as PeerstorePeerId, PublicKey};
use libp2p::core::{UniqueConnecState, PeerId as PeerstorePeerId, PublicKey};
use libp2p::kad::KadConnecController;
use libp2p::peerstore::{Peerstore, PeerAccess};
use libp2p::peerstore::json_peerstore::JsonPeerstore;
@@ -192,7 +192,28 @@ impl NetworkState {
&self.local_public_key
}
/// Returns all the IDs of the peer we have knowledge of.
/// Returns the ID of a random peer of the network.
///
/// Returns `None` if we don't know any peer.
pub fn random_peer(&self) -> Option<PeerstorePeerId> {
// TODO: optimize by putting the operation directly in the peerstore
// https://github.com/libp2p/rust-libp2p/issues/316
let peers = match self.peerstore {
PeersStorage::Memory(ref mem) =>
mem.peers().collect::<Vec<_>>(),
PeersStorage::Json(ref json) =>
json.peers().collect::<Vec<_>>(),
};
if peers.is_empty() {
return None
}
let nth = rand::random::<usize>() % peers.len();
Some(peers[nth].clone())
}
/// Returns all the IDs of the peers on the network we have knowledge of.
///
/// This includes peers we are not connected to.
pub fn known_peers(&self) -> impl Iterator<Item = PeerstorePeerId> {
@@ -402,11 +423,32 @@ impl NetworkState {
}
}
/// Returns true if we should open a new outgoing connection to a peer.
/// This takes into account the number of active peers.
pub fn should_open_outgoing_connections(&self) -> bool {
!self.reserved_only.load(atomic::Ordering::Relaxed) &&
self.connections.read().peer_by_nodeid.len() < self.min_peers as usize
/// Returns the number of open and pending connections with
/// custom protocols.
pub fn num_open_custom_connections(&self) -> u32 {
self.connections
.read()
.info_by_peer
.values()
.filter(|info|
info.protocols.iter().any(|&(_, ref connec)|
match connec.state() {
UniqueConnecState::Pending | UniqueConnecState::Full => true,
_ => false
}
)
)
.count() as u32
}
/// Returns the number of new outgoing custom connections to peers to
/// open. This takes into account the number of active peers.
pub fn should_open_outgoing_custom_connections(&self) -> u32 {
if self.reserved_only.load(atomic::Ordering::Relaxed) {
0
} else {
self.min_peers.saturating_sub(self.num_open_custom_connections())
}
}
/// Returns true if we are connected to the given node.
+101 -48
View File
@@ -29,6 +29,7 @@ use libp2p::core::{upgrade, Transport, MuxedTransport, ConnectionUpgrade};
use libp2p::core::{Endpoint, PeerId as PeerstorePeerId, PublicKey};
use libp2p::core::SwarmController;
use libp2p::ping;
use libp2p::transport_timeout::TransportTimeout;
use {PacketId, SessionInfo, ConnectionFilter, TimerToken};
use rand;
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
@@ -115,7 +116,7 @@ impl NetworkService {
let kad_system = KadSystem::without_init(KadSystemConfig {
parallelism: 3,
local_peer_id: local_peer_id.clone(),
kbuckets_timeout: Duration::from_secs(10),
kbuckets_timeout: Duration::from_secs(600),
request_timeout: Duration::from_secs(10),
known_initial_peers: network_state.known_peers().collect(),
});
@@ -407,8 +408,10 @@ fn init_thread(
let shared = shared.clone();
move |peer_id| {
let addrs = shared.network_state.addrs_of_peer(&peer_id);
trace!(target: "sub-libp2p", "Peer store: loaded {} addresses \
for {:?}", addrs.len(), peer_id);
for addr in &addrs {
trace!(target: "sub-libp2p", "{:?} resolved as {}",
peer_id, addr);
}
addrs.into_iter()
}
};
@@ -477,6 +480,29 @@ fn init_thread(
}
}
// Explicitely connect to the boostrap nodes as a temporary measure.
for bootnode in shared.config.boot_nodes.iter() {
// TODO: this code is copy-pasted from `network_state`, but it is
// temporary anyway
let mut addr: Multiaddr = bootnode.parse()
.map_err(|_| ErrorKind::AddressParse)?;
let p2p_component = addr.pop().ok_or(ErrorKind::AddressParse)?;
let peer_id = match p2p_component {
AddrComponent::P2P(key) | AddrComponent::IPFS(key) =>
PeerstorePeerId::from_bytes(key).map_err(|_| ErrorKind::AddressParse)?,
_ => return Err(ErrorKind::BadProtocol.into()),
};
trace!(target: "sub-libp2p", "Dialing bootnode {:?}", peer_id);
for proto in shared.protocols.read().0.clone().into_iter() {
open_peer_custom_proto(shared.clone(), transport.clone(),
proto, peer_id.clone(), &swarm_controller)
}
}
// Start connecting to nodes now.
connect_to_nodes(shared.clone(), transport.clone(), &swarm_controller);
// Build the timeouts system for the `register_timeout` function.
// (note: this has nothing to do with socket timeouts)
let timeouts = timeouts::build_timeouts_stream(core.clone(), timeouts_register_rx)
@@ -609,10 +635,11 @@ fn handle_kademlia_connection(
/// When a remote performs a `FIND_NODE` Kademlia request for `searched`,
/// this function builds the response to send back.
fn build_kademlia_response(shared: &Arc<Shared>, searched: &PeerstorePeerId)
-> Vec<KadPeer> {
fn build_kademlia_response(
shared: &Arc<Shared>,
searched: &PeerstorePeerId
) -> Vec<KadPeer> {
shared.kad_system
// TODO the iter of `known_closest_peers` should be infinite
.known_closest_peers(searched)
.map(move |peer_id| {
if peer_id == *shared.kad_system.local_peer_id() {
@@ -638,6 +665,13 @@ fn build_kademlia_response(shared: &Arc<Shared>, searched: &PeerstorePeerId)
}
}
})
// TODO: we really want to remove nodes with no multiaddress from
// the results, but a flaw in the Kad protocol of libp2p makes it
// impossible to return empty results ; therefore we must at least
// return ourselves
.filter(|p| p.node_id == *shared.kad_system.local_peer_id() ||
!p.multiaddrs.is_empty())
.take(20)
.collect::<Vec<_>>()
}
@@ -769,8 +803,6 @@ fn start_kademlia_discovery<T, To, St, C>(shared: Arc<Shared>, transport: T,
To: AsyncRead + AsyncWrite + 'static,
St: MuxedTransport<Output = (FinalUpgrade<C>, Endpoint)> + Clone + 'static,
C: 'static {
let local_peer_id = shared.network_state.local_public_key().clone().into_peer_id();
let kad_init = shared.kad_system.perform_initialization({
let shared = shared.clone();
let transport = transport.clone();
@@ -796,7 +828,7 @@ fn start_kademlia_discovery<T, To, St, C>(shared: Arc<Shared>, transport: T,
// that we don't need to run a timer just for flushing.
let _ = shared.network_state.flush_caches_to_disk();
if shared.network_state.should_open_outgoing_connections() {
if shared.network_state.should_open_outgoing_custom_connections() != 0 {
future::Either::A(perform_kademlia_query(shared.clone(),
transport.clone(), swarm_controller.clone()))
} else {
@@ -804,15 +836,15 @@ fn start_kademlia_discovery<T, To, St, C>(shared: Arc<Shared>, transport: T,
// `min_peers`), pretend we did a lookup but with an empty
// result.
trace!(target: "sub-libp2p", "Bypassing kademlia discovery");
future::Either::B(future::ok(Vec::new()))
future::Either::B(future::ok(()))
}
}
})
.for_each({
let shared = shared.clone();
move |results| {
process_kad_results(shared.clone(), transport.clone(),
swarm_controller.clone(), results, &local_peer_id);
move |_| {
connect_to_nodes(shared.clone(), transport.clone(),
&swarm_controller);
Ok(())
}
});
@@ -826,10 +858,14 @@ fn start_kademlia_discovery<T, To, St, C>(shared: Arc<Shared>, transport: T,
Box::new(final_future) as Box<Future<Item = _, Error = _>>
}
/// Performs a kademlia request to a random node, and returns the results.
fn perform_kademlia_query<T, To, St, C>(shared: Arc<Shared>, transport: T,
swarm_controller: SwarmController<St>)
-> impl Future<Item = Vec<PeerstorePeerId>, Error = IoError>
/// Performs a kademlia request to a random node.
/// Note that we don't actually care about the results, so the future
/// produces `()`.
fn perform_kademlia_query<T, To, St, C>(
shared: Arc<Shared>,
transport: T,
swarm_controller: SwarmController<St>
) -> impl Future<Item = (), Error = IoError>
where T: MuxedTransport<Output = TransportOutput<To>> + Clone + 'static,
T::MultiaddrFuture: 'static,
To: AsyncRead + AsyncWrite + 'static,
@@ -865,52 +901,47 @@ fn perform_kademlia_query<T, To, St, C>(shared: Arc<Shared>, transport: T,
}
None
},
KadQueryEvent::Finished(out) => Some(out),
KadQueryEvent::Finished(_) => Some(()),
}
)
.into_future()
.map_err(|(err, _)| err)
.map(|(out, _)| out.unwrap())
.map(|_| ())
}
/// Processes the results of a Kademlia discovery.
fn process_kad_results<T, To, St, C>(shared: Arc<Shared>, transport: T,
swarm_controller: SwarmController<St>, results: Vec<PeerstorePeerId>,
local_peer_id: &PeerstorePeerId)
/// Connects to additional nodes, if necessary.
fn connect_to_nodes<T, To, St, C>(
shared: Arc<Shared>,
base_transport: T,
swarm_controller: &SwarmController<St>
)
where T: MuxedTransport<Output = TransportOutput<To>> + Clone + 'static,
T::MultiaddrFuture: 'static,
To: AsyncRead + AsyncWrite + 'static,
St: MuxedTransport<Output = (FinalUpgrade<C>, Endpoint)> + Clone + 'static,
C: 'static {
trace!(target: "sub-libp2p", "Processing Kademlia discovery results \
(len = {})", results.len());
let num_slots = shared.network_state.should_open_outgoing_custom_connections();
debug!(target: "sub-libp2p", "Opening up to {} outgoing connections",
num_slots);
for discovered_peer in results {
// Skip if we reach `min_peers`.
// Also skip nodes we are already connected to, in order to not connect twice.
// TODO: better API in network_state
if !shared.network_state.should_open_outgoing_connections() ||
discovered_peer == *local_peer_id ||
shared.network_state.is_peer_disabled(&discovered_peer)
{
trace!(target: "sub-libp2p", "Skipping discovered node {:?}", discovered_peer);
continue
}
for _ in 0 .. num_slots {
// Choose a random peer. We are potentially already connected to
// this peer, but this is not a problem as this function is called
// regularly.
// TODO: is it ^ ?
let peer = match shared.network_state.random_peer() {
Some(p) => p,
// `None` returned when no peer is known
None => break,
};
// Try to dial that node for each registered protocol. Since dialing
// upgrades the connection to use multiplexing, dialing multiple times
// should automatically open multiple substreams.
let addr: Multiaddr = AddrComponent::P2P(discovered_peer.clone().into_bytes()).into();
trace!(target: "sub-libp2p", "Dialing discovered node {:?} for each protocol", addr);
trace!(target: "sub-libp2p", "Ensuring connection to {:?}", peer);
for proto in shared.protocols.read().0.clone().into_iter() {
open_peer_custom_proto(
shared.clone(),
transport.clone(),
proto,
addr.clone(),
discovered_peer.clone(),
&swarm_controller
);
open_peer_custom_proto(shared.clone(), base_transport.clone(),
proto, peer.clone(), swarm_controller)
}
}
}
@@ -923,7 +954,6 @@ fn open_peer_custom_proto<T, To, St, C>(
shared: Arc<Shared>,
base_transport: T,
proto: RegisteredProtocol<Arc<NetworkProtocolHandler + Send + Sync>>,
addr: Multiaddr,
expected_peer_id: PeerstorePeerId,
swarm_controller: &SwarmController<St>
)
@@ -933,9 +963,20 @@ fn open_peer_custom_proto<T, To, St, C>(
St: MuxedTransport<Output = (FinalUpgrade<C>, Endpoint)> + Clone + 'static,
C: 'static,
{
// Don't connect to ourselves.
if &expected_peer_id == shared.kad_system.local_peer_id() {
return
}
// Don't connect to a disabled peer.
if shared.network_state.is_peer_disabled(&expected_peer_id) {
return
}
let proto_id = proto.id();
let peer_id = expected_peer_id.clone();
let shared2 = shared.clone();
let addr: Multiaddr = AddrComponent::P2P(expected_peer_id.clone().into_bytes()).into();
// TODO: check that the secio key matches the id given by kademlia
let with_proto = base_transport
@@ -964,10 +1005,22 @@ fn open_peer_custom_proto<T, To, St, C>(
.and_then(move |out, endpoint, client_addr|
future::ok(((FinalUpgrade::Custom(out), endpoint), client_addr))
);
let with_timeout = TransportTimeout::new(with_proto,
Duration::from_secs(20));
let with_err = with_timeout
.map_err({
let peer_id = peer_id.clone();
move |err| {
debug!(target: "sub-libp2p", "Error while dialing \
{:?} with custom proto: {:?}", peer_id, err);
err
}
});
if let Ok(unique_connec) = shared2.network_state
.custom_proto(peer_id, proto_id, Endpoint::Dialer) {
let _ = unique_connec.1.get_or_dial(&swarm_controller, &addr, with_proto);
let _ = unique_connec.1.get_or_dial(&swarm_controller, &addr, with_err);
}
}
@@ -16,6 +16,8 @@
use libp2p::{self, Transport, secio};
use libp2p::core::{MuxedTransport, either, upgrade};
use libp2p::transport_timeout::TransportTimeout;
use std::time::Duration;
use tokio_core::reactor::Handle;
use tokio_io::{AsyncRead, AsyncWrite};
@@ -25,7 +27,7 @@ pub fn build_transport(
unencrypted_allowed: UnencryptedAllowed,
local_private_key: secio::SecioKeyPair
) -> impl MuxedTransport<Output = impl AsyncRead + AsyncWrite> + Clone {
libp2p::CommonTransport::new(core)
let base = libp2p::CommonTransport::new(core)
.with_upgrade({
let secio = secio::SecioConfig {
key: local_private_key,
@@ -51,7 +53,14 @@ pub fn build_transport(
// TODO: check that the public key matches what is reported by identify
.map(|(socket, _key), _| socket)
.with_upgrade(libp2p::mplex::MultiplexConfig::new())
.into_connection_reuse()
.into_connection_reuse();
TransportTimeout::new(base, Duration::from_secs(20))
.map_err(|err| {
debug!(target: "sub-libp2p", "Error in base transport \
layer: {:?}", err);
err
})
}
/// Specifies whether unencrypted communications are allowed or denied.