Remove dependency on the parity repo (#734)

This commit is contained in:
Arkadiy Paronyan
2018-09-13 14:25:38 +02:00
committed by Gav Wood
parent 88ef57e4bd
commit 0ed48c89ab
12 changed files with 119 additions and 263 deletions
@@ -16,8 +16,6 @@
use std::{io, net, fmt};
use libc::{ENFILE, EMFILE};
use io::IoError;
use ethkey;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DisconnectReason
@@ -82,10 +80,6 @@ impl fmt::Display for DisconnectReason {
}
error_chain! {
foreign_links {
SocketIo(IoError) #[doc = "Socket IO error."];
}
errors {
#[doc = "Error concerning the network address parsing subsystem."]
AddressParse {
@@ -171,17 +165,6 @@ impl From<io::Error> for Error {
}
}
impl From<ethkey::Error> for Error {
fn from(_err: ethkey::Error) -> Self {
ErrorKind::Auth.into()
}
}
impl From<ethkey::crypto::Error> for Error {
fn from(_err: ethkey::crypto::Error) -> Self {
ErrorKind::Auth.into()
}
}
impl From<net::AddrParseError> for Error {
fn from(_err: net::AddrParseError) -> Self { ErrorKind::AddressParse.into() }
+2 -3
View File
@@ -27,7 +27,6 @@ extern crate futures;
extern crate tokio;
extern crate tokio_io;
extern crate tokio_timer;
extern crate ethkey;
extern crate libc;
extern crate libp2p;
extern crate rand;
@@ -38,7 +37,6 @@ extern crate serde_json;
extern crate bytes;
extern crate unsigned_varint;
extern crate ethcore_io as io;
extern crate ethereum_types;
#[macro_use]
@@ -49,11 +47,12 @@ extern crate log;
extern crate assert_matches;
pub use connection_filter::{ConnectionFilter, ConnectionDirection};
pub use io::TimerToken;
pub use error::{Error, ErrorKind, DisconnectReason};
pub use libp2p::{Multiaddr, multiaddr::AddrComponent};
pub use traits::*;
pub type TimerToken = usize;
mod connection_filter;
mod custom_proto;
mod error;
+4 -2
View File
@@ -20,10 +20,9 @@ use std::iter;
use std::net::Ipv4Addr;
use std::str;
use std::time::Duration;
use io::TimerToken;
use TimerToken;
use libp2p::{multiaddr::AddrComponent, Multiaddr};
use error::Error;
use ethkey::Secret;
use ethereum_types::H512;
/// Protocol handler level packet id
@@ -37,6 +36,9 @@ pub type NodeId = H512;
/// Local (temporary) peer session ID.
pub type NodeIndex = usize;
/// secio secret key;
pub type Secret = [u8; 32];
/// Shared session information
#[derive(Debug, Clone)]
pub struct SessionInfo {
@@ -30,9 +30,7 @@ pub fn build_transport(
mplex_config.max_buffer_len(usize::MAX);
let base = libp2p::CommonTransport::new()
.with_upgrade(secio::SecioConfig {
key: local_private_key,
})
.with_upgrade(secio::SecioConfig::new(local_private_key))
.and_then(move |out, endpoint, client_addr| {
let upgrade = upgrade::or(
upgrade::map(mplex_config, either::EitherOutput::First),