Rewrite the libp2p networking (#742)

* Rewrite the libp2p networking

* Fix erroneous replacement during rebase

* Update libp2p

* Update libp2p

* Remove the logic error about useless substreams

* Use the new NodeHandler system of libp2p

* Commit the Cargo.lock

* Upgrade yamux

* Forward port latest changes

* Fix compilation issues

* Implement the external URL

* Update to latest networking fixes

* Forward port rest of v0.2

* Fix reserved peers being dropped when we're full
This commit is contained in:
Pierre Krieger
2018-09-26 11:56:32 +02:00
committed by Arkadiy Paronyan
parent abf799f78f
commit 52dbf0cace
16 changed files with 3504 additions and 2369 deletions
+7 -7
View File
@@ -21,7 +21,7 @@ use std::net::Ipv4Addr;
use std::str;
use std::time::Duration;
use TimerToken;
use libp2p::{multiaddr::AddrComponent, Multiaddr};
use libp2p::{multiaddr::Protocol, Multiaddr};
use error::Error;
use ethereum_types::H512;
@@ -139,18 +139,18 @@ impl NetworkConfiguration {
config_path: None,
net_config_path: None,
listen_addresses: vec![
iter::once(AddrComponent::IP4(Ipv4Addr::new(0, 0, 0, 0)))
.chain(iter::once(AddrComponent::TCP(30333)))
iter::once(Protocol::Ip4(Ipv4Addr::new(0, 0, 0, 0)))
.chain(iter::once(Protocol::Tcp(30333)))
.collect()
],
public_addresses: Vec::new(),
boot_nodes: Vec::new(),
use_secret: None,
min_peers: 25,
max_peers: 50,
max_peers: 100,
reserved_nodes: Vec::new(),
non_reserved_mode: NonReservedPeerMode::Accept,
client_version: "Parity-network".into(),
client_version: "Parity-network".into(), // TODO: meh
}
}
@@ -158,8 +158,8 @@ impl NetworkConfiguration {
pub fn new_local() -> NetworkConfiguration {
let mut config = NetworkConfiguration::new();
config.listen_addresses = vec![
iter::once(AddrComponent::IP4(Ipv4Addr::new(127, 0, 0, 1)))
.chain(iter::once(AddrComponent::TCP(0)))
iter::once(Protocol::Ip4(Ipv4Addr::new(127, 0, 0, 1)))
.chain(iter::once(Protocol::Tcp(0)))
.collect()
];
config