Removed ethcore-util dependency from ethcore-network (#7180)

* Removed ethcore-util dependency

* Removed snappy
This commit is contained in:
Arkadiy Paronyan
2017-12-02 10:08:04 +01:00
committed by GitHub
parent c544c3e518
commit dde6baedec
14 changed files with 36 additions and 197 deletions

View File

@@ -30,7 +30,6 @@ use mio::*;
use mio::deprecated::{EventLoop};
use mio::tcp::*;
use bigint::hash::*;
use util::version;
use rlp::*;
use session::{Session, SessionInfo, SessionData};
use io::*;
@@ -108,6 +107,8 @@ pub struct NetworkConfiguration {
pub non_reserved_mode: NonReservedPeerMode,
/// IP filter
pub ip_filter: IpFilter,
/// Client identifier
pub client_version: String,
}
impl Default for NetworkConfiguration {
@@ -136,6 +137,7 @@ impl NetworkConfiguration {
ip_filter: IpFilter::default(),
reserved_nodes: Vec::new(),
non_reserved_mode: NonReservedPeerMode::Accept,
client_version: "Parity-network".into(),
}
}
@@ -331,8 +333,6 @@ pub struct HostInfo {
nonce: H256,
/// RLPx protocol version
pub protocol_version: u32,
/// Client identifier
pub client_version: String,
/// Registered capabilities (handlers)
pub capabilities: Vec<CapabilityInfo>,
/// Local address + discovery port
@@ -357,6 +357,10 @@ impl HostInfo {
self.nonce = keccak(&self.nonce);
self.nonce
}
pub fn client_version(&self) -> &str {
&self.config.client_version
}
}
type SharedSession = Arc<Mutex<Session>>;
@@ -423,7 +427,6 @@ impl Host {
config: config,
nonce: H256::random(),
protocol_version: PROTOCOL_VERSION,
client_version: version(),
capabilities: Vec::new(),
public_endpoint: None,
local_endpoint: local_endpoint,
@@ -519,10 +522,6 @@ impl Host {
Ok(())
}
pub fn client_version() -> String {
version()
}
pub fn external_url(&self) -> Option<String> {
let info = self.info.read();
info.public_endpoint.as_ref().map(|e| format!("{}", Node::new(info.id().clone(), e.clone())))