Rename libp2p_swarm to libp2p_core (#189)

This commit is contained in:
Pierre Krieger 2018-05-16 12:59:36 +02:00 committed by GitHub
parent dc6d4df3f8
commit 5c1890e66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 115 additions and 115 deletions

View File

@ -10,7 +10,7 @@ members = [
"peerstore",
"ping",
"secio",
"swarm",
"core",
"tcp-transport",
"websocket",
"multistream-select",

View File

@ -15,17 +15,17 @@ Architecture of the crates of this repository:
backends. Used by `peerstore`.
- `example`: Example usages of this library.
- `libp2p-identify`: Protocol implementation that allows a node A to query another node B what
information B knows about A. Implements the `ConnectionUpgrade` trait of `libp2p-swarm`.
information B knows about A. Implements the `ConnectionUpgrade` trait of `libp2p-core`.
- `libp2p-peerstore`: Generic storage for information about remote peers (their multiaddresses and
their public key), with multiple possible backends. Each multiaddress also has a time-to-live.
Used by `libp2p-swarm`.
Used by `libp2p-core`.
- `libp2p-ping`: Implementation of the `ping` protocol (the exact protocol is specific to libp2p).
Implements the `ConnectionUpgrade` trait of `libp2p-swarm`.
Implements the `ConnectionUpgrade` trait of `libp2p-core`.
- `libp2p-secio`: Implementation of the `secio` protocol. Encrypts communications. Implements the
`ConnectionUpgrade` trait of `libp2p-swarm`.
- `libp2p-swarm`: Core library that contains all the traits of *libp2p* and plugs things together.
- `libp2p-tcp-transport`: Implementation of the `Transport` trait of `libp2p-swarm` for TCP/IP.
- `libp2p-websocket`: Implementation of the `Transport` trait of `libp2p-swarm` for Websockets.
`ConnectionUpgrade` trait of `libp2p-core`.
- `libp2p-core`: Core library that contains all the traits of *libp2p* and plugs things together.
- `libp2p-tcp-transport`: Implementation of the `Transport` trait of `libp2p-core` for TCP/IP.
- `libp2p-websocket`: Implementation of the `Transport` trait of `libp2p-core` for Websockets.
- `multistream-select`: Implementation of the `multistream-select` protocol, which is used to
negotiate a protocol over a newly-established connection with a peer, or after a connection
upgrade.

View File

@ -1,5 +1,5 @@
[package]
name = "libp2p-swarm"
name = "libp2p-core"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -1,4 +1,4 @@
# libp2p-swarm
# libp2p-core
Transport, protocol upgrade and swarm systems of *libp2p*.
@ -64,15 +64,15 @@ listener. An error is produced if the remote doesn't support the protocol corres
connection upgrade.
```rust
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate tokio_core;
use libp2p_swarm::Transport;
use libp2p_core::Transport;
let tokio_core = tokio_core::reactor::Core::new().unwrap();
let tcp_transport = libp2p_tcp_transport::TcpConfig::new(tokio_core.handle());
let upgraded = tcp_transport.with_upgrade(libp2p_swarm::PlainTextConfig);
let upgraded = tcp_transport.with_upgrade(libp2p_core::PlainTextConfig);
// upgraded.dial(...) // automatically applies the plain text protocol on the socket
```
@ -109,13 +109,13 @@ way to use the protocol.
```rust
extern crate futures;
extern crate libp2p_ping;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate tokio_core;
use futures::Future;
use libp2p_ping::Ping;
use libp2p_swarm::Transport;
use libp2p_core::Transport;
let mut core = tokio_core::reactor::Core::new().unwrap();
@ -124,7 +124,7 @@ let ping_finished_future = libp2p_tcp_transport::TcpConfig::new(core.handle())
.with_upgrade(Ping)
// TODO: right now the only available protocol is ping, but we want to replace it with
// something that is more simple to use
.dial("127.0.0.1:12345".parse::<libp2p_swarm::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
.dial("127.0.0.1:12345".parse::<libp2p_core::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
.and_then(|((mut pinger, service), _)| {
pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!())
});
@ -149,20 +149,20 @@ actual protocol, as explained above) into a `Future` producing `()`.
```rust
extern crate futures;
extern crate libp2p_ping;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate tokio_core;
use futures::Future;
use libp2p_ping::Ping;
use libp2p_swarm::Transport;
use libp2p_core::Transport;
let mut core = tokio_core::reactor::Core::new().unwrap();
let transport = libp2p_tcp_transport::TcpConfig::new(core.handle())
.with_dummy_muxing();
let (swarm_controller, swarm_future) = libp2p_swarm::swarm(transport, Ping, |(mut pinger, service), client_addr| {
let (swarm_controller, swarm_future) = libp2p_core::swarm(transport, Ping, |(mut pinger, service), client_addr| {
pinger.ping().map_err(|_| panic!())
.select(service).map_err(|_| panic!())
.map(|_| ())

View File

@ -172,11 +172,11 @@ where
let inner = self.inner;
let future = substream.and_then(move |outbound| {
if let Some(o) = outbound {
debug!(target: "libp2p-swarm", "Using existing multiplexed connection to {}", addr);
debug!(target: "libp2p-core", "Using existing multiplexed connection to {}", addr);
return Either::A(future::ok(o));
}
// The previous stream muxer did not yield a new substream => start new dial
debug!(target: "libp2p-swarm", "No existing connection to {}; dialing", addr);
debug!(target: "libp2p-core", "No existing connection to {}; dialing", addr);
match inner.dial(addr.clone()) {
Ok(dial) => {
let future = dial.into_future().and_then(move |(muxer, addr)| {
@ -193,7 +193,7 @@ where
));
Ok((s, addr))
} else {
error!(target: "libp2p-swarm", "failed to dial to {}", addr);
error!(target: "libp2p-core", "failed to dial to {}", addr);
shared.lock().active_connections.remove(&addr);
Err(io::Error::new(io::ErrorKind::Other, "dial failed"))
}
@ -273,13 +273,13 @@ where
}
Ok(Async::NotReady) => {}
Ok(Async::Ready(None)) => {
debug!(target: "libp2p-swarm", "listener has been closed");
debug!(target: "libp2p-core", "listener has been closed");
if self.connections.is_empty() && self.current_upgrades.is_empty() {
return Ok(Async::Ready(None));
}
}
Err(err) => {
debug!(target: "libp2p-swarm", "error while polling listener: {:?}", err);
debug!(target: "libp2p-core", "error while polling listener: {:?}", err);
if self.connections.is_empty() && self.current_upgrades.is_empty() {
return Err(err);
}
@ -296,7 +296,7 @@ where
}
Err(err) => {
// Insert the rest of the pending upgrades, but not the current one.
debug!(target: "libp2p-swarm", "error while upgrading listener connection: \
debug!(target: "libp2p-core", "error while upgrading listener connection: \
{:?}", err);
return Ok(Async::Ready(Some(future::err(err))));
}
@ -309,7 +309,7 @@ where
match next_incoming.poll() {
Ok(Async::Ready(None)) => {
// stream muxer gave us a `None` => connection should be considered closed
debug!(target: "libp2p-swarm", "no more inbound substreams on {}", client_addr);
debug!(target: "libp2p-core", "no more inbound substreams on {}", client_addr);
self.shared.lock().active_connections.remove(&client_addr);
}
Ok(Async::Ready(Some(incoming))) => {
@ -331,7 +331,7 @@ where
self.connections.push((muxer, next_incoming, client_addr));
}
Err(err) => {
debug!(target: "libp2p-swarm", "error while upgrading the \
debug!(target: "libp2p-core", "error while upgrading the \
multiplexed incoming connection: {:?}", err);
// Insert the rest of the pending connections, but not the current one.
return Ok(Async::Ready(Some(future::err(err))));
@ -384,13 +384,13 @@ where
let (muxer, mut future, addr) = lock.next_incoming.swap_remove(n);
match future.poll() {
Ok(Async::Ready(None)) => {
debug!(target: "libp2p-swarm", "no inbound substream for {}", addr);
debug!(target: "libp2p-core", "no inbound substream for {}", addr);
lock.active_connections.remove(&addr);
}
Ok(Async::Ready(Some(value))) => {
// A substream is ready ; push back the muxer for the next time this function
// is called, then return.
debug!(target: "libp2p-swarm", "New incoming substream");
debug!(target: "libp2p-core", "New incoming substream");
let next = muxer.clone().inbound();
lock.next_incoming.push((muxer, next, addr.clone()));
return Ok(Async::Ready(future::ok((value, addr))));
@ -400,7 +400,7 @@ where
}
Err(err) => {
// In case of error, we just not push back the element, which drops it.
debug!(target: "libp2p-swarm", "ConnectionReuse incoming: one of the \
debug!(target: "libp2p-core", "ConnectionReuse incoming: one of the \
multiplexed substreams produced an error: {:?}",
err);
}

View File

@ -85,16 +85,16 @@
//! connection upgrade.
//!
//! ```
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate tokio_core;
//!
//! use libp2p_swarm::Transport;
//! use libp2p_core::Transport;
//!
//! # fn main() {
//! let tokio_core = tokio_core::reactor::Core::new().unwrap();
//! let tcp_transport = libp2p_tcp_transport::TcpConfig::new(tokio_core.handle());
//! let upgraded = tcp_transport.with_upgrade(libp2p_swarm::upgrade::PlainTextConfig);
//! let upgraded = tcp_transport.with_upgrade(libp2p_core::upgrade::PlainTextConfig);
//!
//! // upgraded.dial(...) // automatically applies the plain text protocol on the socket
//! # }
@ -132,13 +132,13 @@
//! ```no_run
//! extern crate futures;
//! extern crate libp2p_ping;
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate tokio_core;
//!
//! use futures::Future;
//! use libp2p_ping::Ping;
//! use libp2p_swarm::Transport;
//! use libp2p_core::Transport;
//!
//! # fn main() {
//! let mut core = tokio_core::reactor::Core::new().unwrap();
@ -148,7 +148,7 @@
//! .with_upgrade(Ping)
//! // TODO: right now the only available protocol is ping, but we want to replace it with
//! // something that is more simple to use
//! .dial("127.0.0.1:12345".parse::<libp2p_swarm::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
//! .dial("127.0.0.1:12345".parse::<libp2p_core::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
//! .and_then(|((mut pinger, service), _)| {
//! pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!())
//! });
@ -174,13 +174,13 @@
//! ```no_run
//! extern crate futures;
//! extern crate libp2p_ping;
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate tokio_core;
//!
//! use futures::Future;
//! use libp2p_ping::Ping;
//! use libp2p_swarm::Transport;
//! use libp2p_core::Transport;
//!
//! # fn main() {
//! let mut core = tokio_core::reactor::Core::new().unwrap();
@ -188,7 +188,7 @@
//! let transport = libp2p_tcp_transport::TcpConfig::new(core.handle())
//! .with_dummy_muxing();
//!
//! let (swarm_controller, swarm_future) = libp2p_swarm::swarm(transport.with_upgrade(Ping),
//! let (swarm_controller, swarm_future) = libp2p_core::swarm(transport.with_upgrade(Ping),
//! |(mut pinger, service), client_addr| {
//! pinger.ping().map_err(|_| panic!())
//! .select(service).map_err(|_| panic!())

View File

@ -118,7 +118,7 @@ where
Du: Transport + 'static, // TODO: 'static :-/
Du::Output: Into<T::Output>,
{
trace!(target: "libp2p-swarm", "Swarm dialing {}", multiaddr);
trace!(target: "libp2p-core", "Swarm dialing {}", multiaddr);
match transport.dial(multiaddr.clone()) {
Ok(dial) => {
@ -152,7 +152,7 @@ where
Df: FnOnce(Du::Output, Multiaddr) -> Dfu + 'static, // TODO: 'static :-/
Dfu: IntoFuture<Item = (), Error = IoError> + 'static, // TODO: 'static :-/
{
trace!(target: "libp2p-swarm", "Swarm dialing {} with custom handler", multiaddr);
trace!(target: "libp2p-core", "Swarm dialing {} with custom handler", multiaddr);
match transport.dial(multiaddr) {
Ok(dial) => {
@ -171,7 +171,7 @@ where
pub fn listen_on(&self, multiaddr: Multiaddr) -> Result<Multiaddr, Multiaddr> {
match self.transport.clone().listen_on(multiaddr) {
Ok((listener, new_addr)) => {
trace!(target: "libp2p-swarm", "Swarm listening on {}", new_addr);
trace!(target: "libp2p-core", "Swarm listening on {}", new_addr);
// Ignoring errors if the receiver has been closed, because in that situation
// nothing is going to be processed anyway.
let _ = self.new_listeners.unbounded_send(listener);
@ -225,14 +225,14 @@ where
match self.next_incoming.poll() {
Ok(Async::Ready(connec)) => {
debug!(target: "libp2p-swarm", "Swarm received new multiplexed \
debug!(target: "libp2p-core", "Swarm received new multiplexed \
incoming connection");
self.next_incoming = self.transport.clone().next_incoming();
self.listeners_upgrade.push(Box::new(connec) as Box<_>);
}
Ok(Async::NotReady) => {}
Err(err) => {
debug!(target: "libp2p-swarm", "Error in multiplexed incoming \
debug!(target: "libp2p-core", "Error in multiplexed incoming \
connection: {:?}", err);
self.next_incoming = self.transport.clone().next_incoming();
}
@ -273,12 +273,12 @@ where
match self.listeners.poll() {
Ok(Async::Ready(Some((Some(upgrade), remaining)))) => {
trace!(target: "libp2p-swarm", "Swarm received new connection on listener socket");
trace!(target: "libp2p-core", "Swarm received new connection on listener socket");
self.listeners_upgrade.push(upgrade);
self.listeners.push(remaining.into_future());
}
Err((err, _)) => {
warn!(target: "libp2p-swarm", "Error in listener: {:?}", err);
warn!(target: "libp2p-core", "Error in listener: {:?}", err);
}
_ => {}
}
@ -294,7 +294,7 @@ where
));
}
Err(err) => {
warn!(target: "libp2p-swarm", "Error in listener upgrade: {:?}", err);
warn!(target: "libp2p-core", "Error in listener upgrade: {:?}", err);
}
_ => {}
}
@ -306,17 +306,17 @@ where
.push(future::Either::A(handler(output, addr).into_future()));
}
Err(err) => {
warn!(target: "libp2p-swarm", "Error in dialer upgrade: {:?}", err);
warn!(target: "libp2p-core", "Error in dialer upgrade: {:?}", err);
}
_ => {}
}
match self.to_process.poll() {
Ok(Async::Ready(Some(()))) => {
trace!(target: "libp2p-swarm", "Future returned by swarm handler driven to completion");
trace!(target: "libp2p-core", "Future returned by swarm handler driven to completion");
}
Err(err) => {
warn!(target: "libp2p-swarm", "Error in processing: {:?}", err);
warn!(target: "libp2p-core", "Error in processing: {:?}", err);
}
_ => {}
}

View File

@ -45,7 +45,7 @@ where
.protocol_names()
.map::<_, fn(_) -> _>(|(n, t)| (n, <Bytes as PartialEq>::eq, t));
let remote_addr2 = remote_addr.clone();
debug!(target: "libp2p-swarm", "Starting protocol negotiation");
debug!(target: "libp2p-core", "Starting protocol negotiation");
let negotiation = match endpoint {
Endpoint::Listener => multistream_select::listener_select_proto(connection, iter),
@ -56,9 +56,9 @@ where
.map_err(|err| IoError::new(IoErrorKind::Other, err))
.then(move |negotiated| {
match negotiated {
Ok(_) => debug!(target: "libp2p-swarm", "Successfully negotiated \
Ok(_) => debug!(target: "libp2p-core", "Successfully negotiated \
protocol upgrade with {}", remote_addr2),
Err(ref err) => debug!(target: "libp2p-swarm", "Error while negotiated \
Err(ref err) => debug!(target: "libp2p-core", "Error while negotiated \
protocol upgrade: {:?}", err),
};
negotiated
@ -70,9 +70,9 @@ where
.into_future()
.then(|val| {
match val {
Ok(_) => debug!(target: "libp2p-swarm", "Successfully applied negotiated \
Ok(_) => debug!(target: "libp2p-core", "Successfully applied negotiated \
protocol"),
Err(_) => debug!(target: "libp2p-swarm", "Failed to apply negotiated protocol"),
Err(_) => debug!(target: "libp2p-core", "Failed to apply negotiated protocol"),
}
val
});

View File

@ -21,7 +21,7 @@
extern crate bytes;
extern crate futures;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate tokio_core;
extern crate tokio_io;
@ -29,7 +29,7 @@ extern crate tokio_io;
use bytes::BytesMut;
use futures::future::Future;
use futures::{Sink, Stream};
use libp2p_swarm::{Multiaddr, MuxedTransport, StreamMuxer, Transport};
use libp2p_core::{Multiaddr, MuxedTransport, StreamMuxer, Transport};
use libp2p_tcp_transport::TcpConfig;
use std::sync::{atomic, mpsc};
use std::thread;

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
futures = "0.1"
multiaddr = "0.3.0"

View File

@ -37,7 +37,7 @@
//!
extern crate futures;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
#[macro_use]
extern crate log;
extern crate multiaddr;

View File

@ -16,7 +16,7 @@ libp2p-floodsub = { path = "../floodsub" }
libp2p-peerstore = { path = "../peerstore" }
libp2p-ping = { path = "../ping" }
libp2p-secio = { path = "../secio" }
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
libp2p-tcp-transport = { path = "../tcp-transport" }
libp2p-websocket = { path = "../websocket" }
rand = "0.4"

View File

@ -23,7 +23,7 @@ extern crate env_logger;
extern crate futures;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_secio as secio;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate libp2p_websocket as websocket;
extern crate tokio_core;

View File

@ -23,7 +23,7 @@ extern crate env_logger;
extern crate futures;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_secio as secio;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate libp2p_websocket as websocket;
extern crate tokio_core;

View File

@ -25,7 +25,7 @@ extern crate libp2p_floodsub as floodsub;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_peerstore as peerstore;
extern crate libp2p_secio as secio;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate libp2p_websocket as websocket;
extern crate rand;

View File

@ -28,7 +28,7 @@ extern crate libp2p_kad as kad;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_peerstore as peerstore;
extern crate libp2p_secio as secio;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate tokio_core;
extern crate tokio_io;

View File

@ -24,7 +24,7 @@ extern crate futures;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_ping as ping;
extern crate libp2p_secio as secio;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate tokio_core;
extern crate tokio_io;

View File

@ -19,7 +19,7 @@
// DEALINGS IN THE SOFTWARE.
extern crate libp2p_peerstore;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate multiaddr;
use libp2p_peerstore::{PeerAccess, PeerId, Peerstore};

View File

@ -10,7 +10,7 @@ bytes = "0.4"
fnv = "1.0"
futures = "0.1"
libp2p-peerstore = { path = "../peerstore" }
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
multiaddr = "0.3"
parking_lot = "0.5.3"

View File

@ -24,7 +24,7 @@ extern crate bytes;
extern crate fnv;
extern crate futures;
extern crate libp2p_peerstore;
extern crate libp2p_swarm;
extern crate libp2p_core;
#[macro_use]
extern crate log;
extern crate multiaddr;
@ -45,7 +45,7 @@ use fnv::{FnvHashMap, FnvHashSet, FnvHasher};
use futures::sync::mpsc;
use futures::{future, Future, Poll, Sink, Stream};
use libp2p_peerstore::PeerId;
use libp2p_swarm::{ConnectionUpgrade, Endpoint};
use libp2p_core::{ConnectionUpgrade, Endpoint};
use log::Level;
use multiaddr::{AddrComponent, Multiaddr};
use parking_lot::{Mutex, RwLock};

View File

@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
bytes = "0.4"
futures = "0.1"
libp2p-peerstore = { path = "../peerstore" }
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
multiaddr = "0.3.0"
protobuf = "=1.4.2"

View File

@ -68,7 +68,7 @@
extern crate bytes;
extern crate futures;
extern crate libp2p_peerstore;
extern crate libp2p_swarm;
extern crate libp2p_core;
#[macro_use]
extern crate log;
extern crate multiaddr;

View File

@ -20,7 +20,7 @@
use bytes::{Bytes, BytesMut};
use futures::{future, Future, Sink, Stream};
use libp2p_swarm::{ConnectionUpgrade, Endpoint};
use libp2p_core::{ConnectionUpgrade, Endpoint};
use log::Level;
use multiaddr::Multiaddr;
use protobuf::Message as ProtobufMessage;
@ -239,7 +239,7 @@ mod tests {
use self::libp2p_tcp_transport::TcpConfig;
use self::tokio_core::reactor::Core;
use futures::{Future, Stream};
use libp2p_swarm::Transport;
use libp2p_core::Transport;
use std::sync::mpsc;
use std::thread;
use {IdentifyInfo, IdentifyOutput, IdentifyProtocolConfig};

View File

@ -20,7 +20,7 @@
use futures::{future, stream, Future, IntoFuture, Stream};
use libp2p_peerstore::{PeerAccess, PeerId, Peerstore};
use libp2p_swarm::{MuxedTransport, Transport};
use libp2p_core::{MuxedTransport, Transport};
use multiaddr::{AddrComponent, Multiaddr};
use protocol::{IdentifyInfo, IdentifyOutput, IdentifyProtocolConfig};
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
@ -420,7 +420,7 @@ mod tests {
use futures::{Future, Stream};
use libp2p_peerstore::memory_peerstore::MemoryPeerstore;
use libp2p_peerstore::{PeerAccess, PeerId, Peerstore};
use libp2p_swarm::Transport;
use libp2p_core::Transport;
use multiaddr::{AddrComponent, Multiaddr};
use std::io::Error as IoError;
use std::iter;

View File

@ -14,7 +14,7 @@ futures = "0.1"
libp2p-identify = { path = "../identify" }
libp2p-peerstore = { path = "../peerstore" }
libp2p-ping = { path = "../ping" }
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4"
multiaddr = "0.3"
parking_lot = "0.5.1"

View File

@ -29,7 +29,7 @@ use futures::{self, future, Future};
use kad_server::{KadServerInterface, KademliaServerConfig, KademliaServerController};
use kbucket::{KBucketsPeerId, KBucketsTable, UpdateOutcome};
use libp2p_peerstore::{PeerAccess, PeerId, Peerstore};
use libp2p_swarm::{ConnectionUpgrade, Endpoint, MuxedTransport, SwarmController, Transport};
use libp2p_core::{ConnectionUpgrade, Endpoint, MuxedTransport, SwarmController, Transport};
use multiaddr::Multiaddr;
use parking_lot::Mutex;
use protocol::ConnectionType;

View File

@ -39,8 +39,8 @@ use bytes::Bytes;
use futures::sync::{mpsc, oneshot};
use futures::{future, Future, Sink, Stream};
use libp2p_peerstore::PeerId;
use libp2p_swarm::ConnectionUpgrade;
use libp2p_swarm::Endpoint;
use libp2p_core::ConnectionUpgrade;
use libp2p_core::Endpoint;
use multiaddr::{AddrComponent, Multiaddr};
use protocol::{self, KadMsg, KademliaProtocolConfig, Peer};
use std::collections::VecDeque;

View File

@ -71,7 +71,7 @@ extern crate futures;
extern crate libp2p_identify;
extern crate libp2p_peerstore;
extern crate libp2p_ping;
extern crate libp2p_swarm;
extern crate libp2p_core;
#[macro_use]
extern crate log;
extern crate multiaddr;

View File

@ -29,7 +29,7 @@ use bytes::Bytes;
use futures::future;
use futures::{Sink, Stream};
use libp2p_peerstore::PeerId;
use libp2p_swarm::{ConnectionUpgrade, Endpoint, Multiaddr};
use libp2p_core::{ConnectionUpgrade, Endpoint, Multiaddr};
use protobuf::{self, Message};
use protobuf_structs;
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
@ -308,7 +308,7 @@ mod tests {
use self::tokio_core::reactor::Core;
use futures::{Future, Sink, Stream};
use libp2p_peerstore::PeerId;
use libp2p_swarm::Transport;
use libp2p_core::Transport;
use protocol::{ConnectionType, KadMsg, KademliaProtocolConfig, Peer};
use std::sync::mpsc;
use std::thread;

View File

@ -10,7 +10,7 @@ circular-buffer = { path = "../circular-buffer" }
error-chain = "0.11.0"
futures = "0.1"
futures-mutex = { git = "https://github.com/paritytech/futures-mutex" }
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4"
num-bigint = { version = "0.1.40", default-features = false }
num-traits = "0.1.40"

View File

@ -25,7 +25,7 @@ extern crate circular_buffer;
extern crate error_chain;
extern crate futures;
extern crate futures_mutex;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
#[macro_use]
extern crate log;
extern crate num_bigint;

View File

@ -21,7 +21,7 @@
extern crate bytes;
extern crate futures;
extern crate libp2p_mplex as multiplex;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
extern crate libp2p_tcp_transport as tcp;
extern crate tokio_core;
extern crate tokio_io;

View File

@ -5,7 +5,7 @@ authors = ["pierre <pierre.krieger1708@gmail.com>"]
[dependencies]
bytes = "0.4"
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
multiaddr = "0.3.0"
multistream-select = { path = "../multistream-select" }

View File

@ -31,19 +31,19 @@ connections to non-responsive remotes.
```rust
extern crate futures;
extern crate libp2p_ping;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate tokio_core;
use futures::Future;
use libp2p_ping::Ping;
use libp2p_swarm::Transport;
use libp2p_core::Transport;
let mut core = tokio_core::reactor::Core::new().unwrap();
let ping_finished_future = libp2p_tcp_transport::TcpConfig::new(core.handle())
.with_upgrade(Ping)
.dial("127.0.0.1:12345".parse::<libp2p_swarm::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
.dial("127.0.0.1:12345".parse::<libp2p_core::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
.and_then(|((mut pinger, service), _)| {
pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!())
});

View File

@ -54,20 +54,20 @@
//! ```no_run
//! extern crate futures;
//! extern crate libp2p_ping;
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate tokio_core;
//!
//! use futures::Future;
//! use libp2p_ping::Ping;
//! use libp2p_swarm::Transport;
//! use libp2p_core::Transport;
//!
//! # fn main() {
//! let mut core = tokio_core::reactor::Core::new().unwrap();
//!
//! let ping_finished_future = libp2p_tcp_transport::TcpConfig::new(core.handle())
//! .with_upgrade(Ping)
//! .dial("127.0.0.1:12345".parse::<libp2p_swarm::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
//! .dial("127.0.0.1:12345".parse::<libp2p_core::Multiaddr>().unwrap()).unwrap_or_else(|_| panic!())
//! .and_then(|((mut pinger, service), _)| {
//! pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!())
//! });
@ -80,7 +80,7 @@
extern crate bytes;
extern crate futures;
extern crate libp2p_swarm;
extern crate libp2p_core;
#[macro_use]
extern crate log;
extern crate multistream_select;
@ -92,7 +92,7 @@ use bytes::{BufMut, Bytes, BytesMut};
use futures::future::{loop_fn, FutureResult, IntoFuture, Loop};
use futures::sync::{mpsc, oneshot};
use futures::{Future, Sink, Stream};
use libp2p_swarm::{ConnectionUpgrade, Endpoint, Multiaddr};
use libp2p_core::{ConnectionUpgrade, Endpoint, Multiaddr};
use log::Level;
use parking_lot::Mutex;
use rand::Rand;
@ -309,7 +309,7 @@ mod tests {
use futures::Future;
use futures::Stream;
use futures::future::join_all;
use libp2p_swarm::{ConnectionUpgrade, Endpoint};
use libp2p_core::{ConnectionUpgrade, Endpoint};
#[test]
fn ping_pong() {

View File

@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
aio-limited = { git = "https://github.com/paritytech/aio-limited.git" }
futures = "0.1"
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4"
tokio = "0.1"
tokio-io = "0.1"

View File

@ -21,7 +21,7 @@
extern crate aio_limited;
#[macro_use]
extern crate futures;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
#[macro_use]
extern crate log;
extern crate tokio;

View File

@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
bytes = "0.4"
futures = "0.1"
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
protobuf = "=1.4.2"
rand = "0.3.17"

View File

@ -12,13 +12,13 @@ through it.
extern crate futures;
extern crate tokio_core;
extern crate tokio_io;
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_secio;
extern crate libp2p_tcp_transport;
use futures::Future;
use libp2p_secio::{SecioConfig, SecioKeyPair};
use libp2p_swarm::{Multiaddr, Transport};
use libp2p_core::{Multiaddr, Transport};
use libp2p_tcp_transport::TcpConfig;
use tokio_core::reactor::Core;
use tokio_io::io::write_all;

View File

@ -32,14 +32,14 @@
//! extern crate futures;
//! extern crate tokio_core;
//! extern crate tokio_io;
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_secio;
//! extern crate libp2p_tcp_transport;
//!
//! # fn main() {
//! use futures::Future;
//! use libp2p_secio::{SecioConfig, SecioKeyPair};
//! use libp2p_swarm::{Multiaddr, Transport, upgrade};
//! use libp2p_core::{Multiaddr, Transport, upgrade};
//! use libp2p_tcp_transport::TcpConfig;
//! use tokio_core::reactor::Core;
//! use tokio_io::io::write_all;
@ -84,7 +84,7 @@
extern crate bytes;
extern crate crypto;
extern crate futures;
extern crate libp2p_swarm;
extern crate libp2p_core;
#[macro_use]
extern crate log;
extern crate protobuf;
@ -99,7 +99,7 @@ pub use self::error::SecioError;
use bytes::{Bytes, BytesMut};
use futures::stream::MapErr as StreamMapErr;
use futures::{Future, Poll, Sink, StartSend, Stream};
use libp2p_swarm::Multiaddr;
use libp2p_core::Multiaddr;
use ring::signature::RSAKeyPair;
use rw_stream_sink::RwStreamSink;
use std::error::Error;
@ -116,7 +116,7 @@ mod handshake;
mod keys_proto;
mod structs_proto;
/// Implementation of the `ConnectionUpgrade` trait of `libp2p_swarm`. Automatically applies
/// Implementation of the `ConnectionUpgrade` trait of `libp2p_core`. Automatically applies
/// secio on any connection.
#[derive(Clone)]
pub struct SecioConfig {
@ -186,7 +186,7 @@ pub enum SecioPublicKey {
Rsa(Vec<u8>),
}
impl<S> libp2p_swarm::ConnectionUpgrade<S> for SecioConfig
impl<S> libp2p_core::ConnectionUpgrade<S> for SecioConfig
where
S: AsyncRead + AsyncWrite + 'static,
{
@ -208,7 +208,7 @@ where
self,
incoming: S,
_: (),
_: libp2p_swarm::Endpoint,
_: libp2p_core::Endpoint,
remote_addr: &Multiaddr,
) -> Self::Future {
info!(target: "libp2p-secio", "starting secio upgrade with {:?}", remote_addr);

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
log = "0.4.1"
futures = "0.1"
multiaddr = "0.3.0"

View File

@ -50,7 +50,7 @@
//! documentation of `swarm` and of libp2p in general to learn how to use the `Transport` trait.
extern crate futures;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
#[macro_use]
extern crate log;
extern crate multiaddr;

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
libp2p-swarm = { path = "../swarm" }
libp2p-core = { path = "../core" }
futures = "0.1"
multiaddr = "0.3.0"
log = "0.4.1"

View File

@ -30,12 +30,12 @@ This underlying transport must be put inside a `WsConfig` object through the
`WsConfig::new()` function.
```rust
extern crate libp2p_swarm;
extern crate libp2p_core;
extern crate libp2p_tcp_transport;
extern crate libp2p_websocket;
extern crate tokio_core;
use libp2p_swarm::{Multiaddr, Transport};
use libp2p_core::{Multiaddr, Transport};
use libp2p_tcp_transport::TcpConfig;
use libp2p_websocket::WsConfig;
use tokio_core::reactor::Core;

View File

@ -55,12 +55,12 @@
//! `WsConfig::new()` function.
//!
//! ```
//! extern crate libp2p_swarm;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate libp2p_websocket;
//! extern crate tokio_core;
//!
//! use libp2p_swarm::{Multiaddr, Transport};
//! use libp2p_core::{Multiaddr, Transport};
//! use libp2p_tcp_transport::TcpConfig;
//! use libp2p_websocket::WsConfig;
//! use tokio_core::reactor::Core;
@ -75,7 +75,7 @@
//!
extern crate futures;
extern crate libp2p_swarm as swarm;
extern crate libp2p_core as swarm;
#[macro_use]
extern crate log;
extern crate multiaddr;