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", "peerstore",
"ping", "ping",
"secio", "secio",
"swarm", "core",
"tcp-transport", "tcp-transport",
"websocket", "websocket",
"multistream-select", "multistream-select",

View File

@ -15,17 +15,17 @@ Architecture of the crates of this repository:
backends. Used by `peerstore`. backends. Used by `peerstore`.
- `example`: Example usages of this library. - `example`: Example usages of this library.
- `libp2p-identify`: Protocol implementation that allows a node A to query another node B what - `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 - `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. 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). - `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 - `libp2p-secio`: Implementation of the `secio` protocol. Encrypts communications. Implements the
`ConnectionUpgrade` trait of `libp2p-swarm`. `ConnectionUpgrade` trait of `libp2p-core`.
- `libp2p-swarm`: Core library that contains all the traits of *libp2p* and plugs things together. - `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-swarm` for TCP/IP. - `libp2p-tcp-transport`: Implementation of the `Transport` trait of `libp2p-core` for TCP/IP.
- `libp2p-websocket`: Implementation of the `Transport` trait of `libp2p-swarm` for Websockets. - `libp2p-websocket`: Implementation of the `Transport` trait of `libp2p-core` for Websockets.
- `multistream-select`: Implementation of the `multistream-select` protocol, which is used to - `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 negotiate a protocol over a newly-established connection with a peer, or after a connection
upgrade. upgrade.

View File

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

View File

@ -1,4 +1,4 @@
# libp2p-swarm # libp2p-core
Transport, protocol upgrade and swarm systems of *libp2p*. 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. connection upgrade.
```rust ```rust
extern crate libp2p_swarm; extern crate libp2p_core;
extern crate libp2p_tcp_transport; extern crate libp2p_tcp_transport;
extern crate tokio_core; extern crate tokio_core;
use libp2p_swarm::Transport; use libp2p_core::Transport;
let tokio_core = tokio_core::reactor::Core::new().unwrap(); let tokio_core = tokio_core::reactor::Core::new().unwrap();
let tcp_transport = libp2p_tcp_transport::TcpConfig::new(tokio_core.handle()); 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 // upgraded.dial(...) // automatically applies the plain text protocol on the socket
``` ```
@ -109,13 +109,13 @@ way to use the protocol.
```rust ```rust
extern crate futures; extern crate futures;
extern crate libp2p_ping; extern crate libp2p_ping;
extern crate libp2p_swarm; extern crate libp2p_core;
extern crate libp2p_tcp_transport; extern crate libp2p_tcp_transport;
extern crate tokio_core; extern crate tokio_core;
use futures::Future; use futures::Future;
use libp2p_ping::Ping; use libp2p_ping::Ping;
use libp2p_swarm::Transport; use libp2p_core::Transport;
let mut core = tokio_core::reactor::Core::new().unwrap(); 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) .with_upgrade(Ping)
// TODO: right now the only available protocol is ping, but we want to replace it with // TODO: right now the only available protocol is ping, but we want to replace it with
// something that is more simple to use // 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), _)| { .and_then(|((mut pinger, service), _)| {
pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!()) pinger.ping().map_err(|_| panic!()).select(service).map_err(|_| panic!())
}); });
@ -149,20 +149,20 @@ actual protocol, as explained above) into a `Future` producing `()`.
```rust ```rust
extern crate futures; extern crate futures;
extern crate libp2p_ping; extern crate libp2p_ping;
extern crate libp2p_swarm; extern crate libp2p_core;
extern crate libp2p_tcp_transport; extern crate libp2p_tcp_transport;
extern crate tokio_core; extern crate tokio_core;
use futures::Future; use futures::Future;
use libp2p_ping::Ping; use libp2p_ping::Ping;
use libp2p_swarm::Transport; use libp2p_core::Transport;
let mut core = tokio_core::reactor::Core::new().unwrap(); let mut core = tokio_core::reactor::Core::new().unwrap();
let transport = libp2p_tcp_transport::TcpConfig::new(core.handle()) let transport = libp2p_tcp_transport::TcpConfig::new(core.handle())
.with_dummy_muxing(); .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!()) pinger.ping().map_err(|_| panic!())
.select(service).map_err(|_| panic!()) .select(service).map_err(|_| panic!())
.map(|_| ()) .map(|_| ())

View File

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

View File

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

View File

@ -118,7 +118,7 @@ where
Du: Transport + 'static, // TODO: 'static :-/ Du: Transport + 'static, // TODO: 'static :-/
Du::Output: Into<T::Output>, Du::Output: Into<T::Output>,
{ {
trace!(target: "libp2p-swarm", "Swarm dialing {}", multiaddr); trace!(target: "libp2p-core", "Swarm dialing {}", multiaddr);
match transport.dial(multiaddr.clone()) { match transport.dial(multiaddr.clone()) {
Ok(dial) => { Ok(dial) => {
@ -152,7 +152,7 @@ where
Df: FnOnce(Du::Output, Multiaddr) -> Dfu + 'static, // TODO: 'static :-/ Df: FnOnce(Du::Output, Multiaddr) -> Dfu + 'static, // TODO: 'static :-/
Dfu: IntoFuture<Item = (), Error = IoError> + '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) { match transport.dial(multiaddr) {
Ok(dial) => { Ok(dial) => {
@ -171,7 +171,7 @@ where
pub fn listen_on(&self, multiaddr: Multiaddr) -> Result<Multiaddr, Multiaddr> { pub fn listen_on(&self, multiaddr: Multiaddr) -> Result<Multiaddr, Multiaddr> {
match self.transport.clone().listen_on(multiaddr) { match self.transport.clone().listen_on(multiaddr) {
Ok((listener, new_addr)) => { 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 // Ignoring errors if the receiver has been closed, because in that situation
// nothing is going to be processed anyway. // nothing is going to be processed anyway.
let _ = self.new_listeners.unbounded_send(listener); let _ = self.new_listeners.unbounded_send(listener);
@ -225,14 +225,14 @@ where
match self.next_incoming.poll() { match self.next_incoming.poll() {
Ok(Async::Ready(connec)) => { Ok(Async::Ready(connec)) => {
debug!(target: "libp2p-swarm", "Swarm received new multiplexed \ debug!(target: "libp2p-core", "Swarm received new multiplexed \
incoming connection"); incoming connection");
self.next_incoming = self.transport.clone().next_incoming(); self.next_incoming = self.transport.clone().next_incoming();
self.listeners_upgrade.push(Box::new(connec) as Box<_>); self.listeners_upgrade.push(Box::new(connec) as Box<_>);
} }
Ok(Async::NotReady) => {} Ok(Async::NotReady) => {}
Err(err) => { Err(err) => {
debug!(target: "libp2p-swarm", "Error in multiplexed incoming \ debug!(target: "libp2p-core", "Error in multiplexed incoming \
connection: {:?}", err); connection: {:?}", err);
self.next_incoming = self.transport.clone().next_incoming(); self.next_incoming = self.transport.clone().next_incoming();
} }
@ -273,12 +273,12 @@ where
match self.listeners.poll() { match self.listeners.poll() {
Ok(Async::Ready(Some((Some(upgrade), remaining)))) => { 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_upgrade.push(upgrade);
self.listeners.push(remaining.into_future()); self.listeners.push(remaining.into_future());
} }
Err((err, _)) => { 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) => { 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())); .push(future::Either::A(handler(output, addr).into_future()));
} }
Err(err) => { 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() { match self.to_process.poll() {
Ok(Async::Ready(Some(()))) => { 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) => { 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() .protocol_names()
.map::<_, fn(_) -> _>(|(n, t)| (n, <Bytes as PartialEq>::eq, t)); .map::<_, fn(_) -> _>(|(n, t)| (n, <Bytes as PartialEq>::eq, t));
let remote_addr2 = remote_addr.clone(); let remote_addr2 = remote_addr.clone();
debug!(target: "libp2p-swarm", "Starting protocol negotiation"); debug!(target: "libp2p-core", "Starting protocol negotiation");
let negotiation = match endpoint { let negotiation = match endpoint {
Endpoint::Listener => multistream_select::listener_select_proto(connection, iter), Endpoint::Listener => multistream_select::listener_select_proto(connection, iter),
@ -56,9 +56,9 @@ where
.map_err(|err| IoError::new(IoErrorKind::Other, err)) .map_err(|err| IoError::new(IoErrorKind::Other, err))
.then(move |negotiated| { .then(move |negotiated| {
match negotiated { match negotiated {
Ok(_) => debug!(target: "libp2p-swarm", "Successfully negotiated \ Ok(_) => debug!(target: "libp2p-core", "Successfully negotiated \
protocol upgrade with {}", remote_addr2), 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), protocol upgrade: {:?}", err),
}; };
negotiated negotiated
@ -70,9 +70,9 @@ where
.into_future() .into_future()
.then(|val| { .then(|val| {
match val { match val {
Ok(_) => debug!(target: "libp2p-swarm", "Successfully applied negotiated \ Ok(_) => debug!(target: "libp2p-core", "Successfully applied negotiated \
protocol"), protocol"),
Err(_) => debug!(target: "libp2p-swarm", "Failed to apply negotiated protocol"), Err(_) => debug!(target: "libp2p-core", "Failed to apply negotiated protocol"),
} }
val val
}); });

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ extern crate env_logger;
extern crate futures; extern crate futures;
extern crate libp2p_mplex as multiplex; extern crate libp2p_mplex as multiplex;
extern crate libp2p_secio as secio; 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_tcp_transport as tcp;
extern crate libp2p_websocket as websocket; extern crate libp2p_websocket as websocket;
extern crate tokio_core; extern crate tokio_core;

View File

@ -23,7 +23,7 @@ extern crate env_logger;
extern crate futures; extern crate futures;
extern crate libp2p_mplex as multiplex; extern crate libp2p_mplex as multiplex;
extern crate libp2p_secio as secio; 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_tcp_transport as tcp;
extern crate libp2p_websocket as websocket; extern crate libp2p_websocket as websocket;
extern crate tokio_core; 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_mplex as multiplex;
extern crate libp2p_peerstore as peerstore; extern crate libp2p_peerstore as peerstore;
extern crate libp2p_secio as secio; 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_tcp_transport as tcp;
extern crate libp2p_websocket as websocket; extern crate libp2p_websocket as websocket;
extern crate rand; extern crate rand;

View File

@ -28,7 +28,7 @@ extern crate libp2p_kad as kad;
extern crate libp2p_mplex as multiplex; extern crate libp2p_mplex as multiplex;
extern crate libp2p_peerstore as peerstore; extern crate libp2p_peerstore as peerstore;
extern crate libp2p_secio as secio; 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_tcp_transport as tcp;
extern crate tokio_core; extern crate tokio_core;
extern crate tokio_io; extern crate tokio_io;

View File

@ -24,7 +24,7 @@ extern crate futures;
extern crate libp2p_mplex as multiplex; extern crate libp2p_mplex as multiplex;
extern crate libp2p_ping as ping; extern crate libp2p_ping as ping;
extern crate libp2p_secio as secio; 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_tcp_transport as tcp;
extern crate tokio_core; extern crate tokio_core;
extern crate tokio_io; extern crate tokio_io;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ use futures::{self, future, Future};
use kad_server::{KadServerInterface, KademliaServerConfig, KademliaServerController}; use kad_server::{KadServerInterface, KademliaServerConfig, KademliaServerController};
use kbucket::{KBucketsPeerId, KBucketsTable, UpdateOutcome}; use kbucket::{KBucketsPeerId, KBucketsTable, UpdateOutcome};
use libp2p_peerstore::{PeerAccess, PeerId, Peerstore}; 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 multiaddr::Multiaddr;
use parking_lot::Mutex; use parking_lot::Mutex;
use protocol::ConnectionType; use protocol::ConnectionType;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
extern crate bytes; extern crate bytes;
extern crate futures; extern crate futures;
extern crate libp2p_mplex as multiplex; 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 libp2p_tcp_transport as tcp;
extern crate tokio_core; extern crate tokio_core;
extern crate tokio_io; extern crate tokio_io;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,14 +32,14 @@
//! extern crate futures; //! extern crate futures;
//! extern crate tokio_core; //! extern crate tokio_core;
//! extern crate tokio_io; //! extern crate tokio_io;
//! extern crate libp2p_swarm; //! extern crate libp2p_core;
//! extern crate libp2p_secio; //! extern crate libp2p_secio;
//! extern crate libp2p_tcp_transport; //! extern crate libp2p_tcp_transport;
//! //!
//! # fn main() { //! # fn main() {
//! use futures::Future; //! use futures::Future;
//! use libp2p_secio::{SecioConfig, SecioKeyPair}; //! use libp2p_secio::{SecioConfig, SecioKeyPair};
//! use libp2p_swarm::{Multiaddr, Transport, upgrade}; //! use libp2p_core::{Multiaddr, Transport, upgrade};
//! use libp2p_tcp_transport::TcpConfig; //! use libp2p_tcp_transport::TcpConfig;
//! use tokio_core::reactor::Core; //! use tokio_core::reactor::Core;
//! use tokio_io::io::write_all; //! use tokio_io::io::write_all;
@ -84,7 +84,7 @@
extern crate bytes; extern crate bytes;
extern crate crypto; extern crate crypto;
extern crate futures; extern crate futures;
extern crate libp2p_swarm; extern crate libp2p_core;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate protobuf; extern crate protobuf;
@ -99,7 +99,7 @@ pub use self::error::SecioError;
use bytes::{Bytes, BytesMut}; use bytes::{Bytes, BytesMut};
use futures::stream::MapErr as StreamMapErr; use futures::stream::MapErr as StreamMapErr;
use futures::{Future, Poll, Sink, StartSend, Stream}; use futures::{Future, Poll, Sink, StartSend, Stream};
use libp2p_swarm::Multiaddr; use libp2p_core::Multiaddr;
use ring::signature::RSAKeyPair; use ring::signature::RSAKeyPair;
use rw_stream_sink::RwStreamSink; use rw_stream_sink::RwStreamSink;
use std::error::Error; use std::error::Error;
@ -116,7 +116,7 @@ mod handshake;
mod keys_proto; mod keys_proto;
mod structs_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. /// secio on any connection.
#[derive(Clone)] #[derive(Clone)]
pub struct SecioConfig { pub struct SecioConfig {
@ -186,7 +186,7 @@ pub enum SecioPublicKey {
Rsa(Vec<u8>), Rsa(Vec<u8>),
} }
impl<S> libp2p_swarm::ConnectionUpgrade<S> for SecioConfig impl<S> libp2p_core::ConnectionUpgrade<S> for SecioConfig
where where
S: AsyncRead + AsyncWrite + 'static, S: AsyncRead + AsyncWrite + 'static,
{ {
@ -208,7 +208,7 @@ where
self, self,
incoming: S, incoming: S,
_: (), _: (),
_: libp2p_swarm::Endpoint, _: libp2p_core::Endpoint,
remote_addr: &Multiaddr, remote_addr: &Multiaddr,
) -> Self::Future { ) -> Self::Future {
info!(target: "libp2p-secio", "starting secio upgrade with {:?}", remote_addr); 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>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
libp2p-swarm = { path = "../swarm" } libp2p-core = { path = "../core" }
log = "0.4.1" log = "0.4.1"
futures = "0.1" futures = "0.1"
multiaddr = "0.3.0" 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. //! documentation of `swarm` and of libp2p in general to learn how to use the `Transport` trait.
extern crate futures; extern crate futures;
extern crate libp2p_swarm as swarm; extern crate libp2p_core as swarm;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate multiaddr; extern crate multiaddr;

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
libp2p-swarm = { path = "../swarm" } libp2p-core = { path = "../core" }
futures = "0.1" futures = "0.1"
multiaddr = "0.3.0" multiaddr = "0.3.0"
log = "0.4.1" 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. `WsConfig::new()` function.
```rust ```rust
extern crate libp2p_swarm; extern crate libp2p_core;
extern crate libp2p_tcp_transport; extern crate libp2p_tcp_transport;
extern crate libp2p_websocket; extern crate libp2p_websocket;
extern crate tokio_core; extern crate tokio_core;
use libp2p_swarm::{Multiaddr, Transport}; use libp2p_core::{Multiaddr, Transport};
use libp2p_tcp_transport::TcpConfig; use libp2p_tcp_transport::TcpConfig;
use libp2p_websocket::WsConfig; use libp2p_websocket::WsConfig;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;

View File

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