mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-08-01 01:11:58 +00:00
Refactor multiaddr crate. (#498)
Refactor multiaddr crate. - Remove `AddrComponent`. Instead `Protocol` directly contains its associated data. - Various smaller changes around conversions to Multiaddr from other types, e.g. socket addresses. - Expand tests to include property tests which test encoding/decoding identity.
This commit is contained in:
@@ -253,7 +253,7 @@ pub mod transport;
|
||||
pub mod upgrade;
|
||||
|
||||
pub use self::connection_reuse::ConnectionReuse;
|
||||
pub use self::multiaddr::{AddrComponent, Multiaddr};
|
||||
pub use self::multiaddr::Multiaddr;
|
||||
pub use self::muxing::StreamMuxer;
|
||||
pub use self::peer_id::PeerId;
|
||||
pub use self::public_key::PublicKey;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
use bytes::{Bytes, IntoBuf};
|
||||
use futures::{future::{self, FutureResult}, prelude::*, stream, sync::mpsc};
|
||||
use multiaddr::{AddrComponent, Multiaddr};
|
||||
use multiaddr::{Protocol, Multiaddr};
|
||||
use parking_lot::Mutex;
|
||||
use rw_stream_sink::RwStreamSink;
|
||||
use std::{io, sync::Arc};
|
||||
@@ -132,7 +132,7 @@ impl<T: IntoBuf + Send + 'static> Transport for Listener<T> {
|
||||
/// Returns `true` if and only if the address is `/memory`.
|
||||
fn is_memory_addr(a: &Multiaddr) -> bool {
|
||||
let mut iter = a.iter();
|
||||
if iter.next() != Some(AddrComponent::Memory) {
|
||||
if iter.next() != Some(Protocol::Memory) {
|
||||
return false;
|
||||
}
|
||||
if iter.next().is_some() {
|
||||
|
Reference in New Issue
Block a user