Removes obsolete is_valid_node_url()

This commit is contained in:
Dmitry Kashitsyn 2017-11-06 13:01:37 +07:00
parent 1516fc1c57
commit 851401dded
3 changed files with 3 additions and 9 deletions

View File

@ -73,7 +73,7 @@ mod api;
pub use api::*;
pub use chain::{SyncStatus, SyncState};
pub use network::{is_valid_node_url, validate_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
pub use network::{validate_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
#[cfg(test)]
pub(crate) type Address = bigint::hash::H160;

View File

@ -115,7 +115,7 @@ pub use session::SessionInfo;
pub use connection_filter::{ConnectionFilter, ConnectionDirection};
pub use io::TimerToken;
pub use node_table::{is_valid_node_url, validate_node_url, NodeId};
pub use node_table::{validate_node_url, NodeId};
use ipnetwork::{IpNetwork, IpNetworkError};
use std::str::FromStr;

View File

@ -363,12 +363,6 @@ impl Drop for NodeTable {
}
/// Check if node url is valid
pub fn is_valid_node_url(url: &str) -> bool {
use std::str::FromStr;
Node::from_str(url).is_ok()
}
/// Same as `is_valid_node_url` but returns detailed `NetworkError`
pub fn validate_node_url(url: &str) -> Option<NetworkError> {
use std::str::FromStr;
match Node::from_str(url) {
@ -399,7 +393,7 @@ mod tests {
#[test]
fn node_parse() {
assert!(is_valid_node_url("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770"));
assert!(validate_node_url("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").is_some());
let node = Node::from_str("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770");
assert!(node.is_ok());
let node = node.unwrap();