Remove regex &c., use network code for enode ID.

This commit is contained in:
Gav Wood 2016-02-19 19:42:23 +01:00
parent fd71e1395c
commit 6c82e405dd
3 changed files with 3 additions and 12 deletions

1
Cargo.lock generated
View File

@ -12,7 +12,6 @@ dependencies = [
"ethcore-util 0.9.99", "ethcore-util 0.9.99",
"ethsync 0.9.99", "ethsync 0.9.99",
"fdlimit 0.1.0", "fdlimit 0.1.0",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -19,8 +19,6 @@ ethcore-rpc = { path = "rpc", optional = true }
fdlimit = { path = "util/fdlimit" } fdlimit = { path = "util/fdlimit" }
target_info = "0.1" target_info = "0.1"
daemonize = "0.2" daemonize = "0.2"
regex = "0.1"
lazy_static = "0.1"
[features] [features]
default = ["rpc"] default = ["rpc"]

View File

@ -26,8 +26,6 @@ extern crate ethcore;
extern crate ethsync; extern crate ethsync;
#[macro_use] #[macro_use]
extern crate log as rlog; extern crate log as rlog;
#[macro_use]
extern crate lazy_static;
extern crate env_logger; extern crate env_logger;
extern crate ctrlc; extern crate ctrlc;
extern crate fdlimit; extern crate fdlimit;
@ -40,11 +38,13 @@ extern crate ethcore_rpc as rpc;
use std::net::{SocketAddr}; use std::net::{SocketAddr};
use std::env; use std::env;
use std::from_str::FromStr;
use std::process::exit; use std::process::exit;
use rlog::{LogLevelFilter}; use rlog::{LogLevelFilter};
use env_logger::LogBuilder; use env_logger::LogBuilder;
use ctrlc::CtrlC; use ctrlc::CtrlC;
use util::*; use util::*;
use util::network::node::Node;
use util::panics::MayPanic; use util::panics::MayPanic;
use ethcore::spec::*; use ethcore::spec::*;
use ethcore::client::*; use ethcore::client::*;
@ -194,13 +194,7 @@ impl Configuration {
} }
fn normalize_enode(e: &str) -> Option<String> { fn normalize_enode(e: &str) -> Option<String> {
lazy_static! { Node::from_str(e).ok().map(|_| e.to_owned())
static ref RE: Regex = Regex::new(r"^enode://([0-9a-fA-F]{64})@(\d+\.\d+\.\d+\.\d+):(\d+)$").unwrap();
}
match RE.is_match(e) {
true => Some(e.to_owned()),
false => None,
}
} }
fn init_nodes(&self, spec: &Spec) -> Vec<String> { fn init_nodes(&self, spec: &Spec) -> Vec<String> {