mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-15 02:51:25 +00:00
Cherry-pick commits from master to stable-futures (#1296)
* Implement Debug for (ed25519|secp256k1)::(Keypair|SecretKey) (#1285) * Fix possible arithmetic overflow in libp2p-kad. (#1291) When the number of active queries exceeds the (internal) JOBS_MAX_QUERIES limit, which is only supposed to bound the number of concurrent queries relating to background jobs, an arithmetic overflow occurs. This is fixed by using saturating subtraction. * protocols/plaintext: Add example on how to upgrade with PlainTextConfig1 (#1286) * [mdns] - Support for long mDNS names (Bug #1232) (#1287) * Dead code -- commenting out with a note referencing future implementation * Adding "std" feature so that cargo can build in other directories (notably `misc/mdns`, so that I could run these tests) * Permitting `PeerID` to be built from an `Identity` multihash * The length limit for DNS labels is 63 characters, as per RFC1035 * Allocates the vector with capacity for the service name plus additional QNAME encoding bytes * Added support for encoding/decoding peer IDs with an encoded length greater than 63 characters * Removing "std" from ring features Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com> * Retaining MAX_INLINE_KEY_LENGTH with comment about future usage * `segment_peer_id` consumes `peer_id` ... plus an early return for IDs that don't need to be segmented * Fixing logic * Bump most dependencies (#1268) * Bump most dependencies This actually builds 😊. * Bump all dependencies Includes the excellent work of @rschulman in #1265. * Remove use of ed25519-dalek fork * Monomorphize more dependencies * Add compatibility hack for rand Cargo allows a crate to depend on multiple versions of another, but `cargo-web` panics in that situation. Use a wrapper crate to work around the panic. * Use @tomaka’s idea for using a newer `rand` instead of my own ugly hack. * Switch to Parity master as its dependency-bumping PR has been merged. * Update some depenendencies again * Remove unwraps and `#[allow(deprecated)]`. * Remove spurious changes to dependencies Bumping minor or patch versions is not needed, and increases likelyhood of merge conflicts. * Remove some redundant Cargo.toml changes * Replace a retry loop with an expect `ed25519::SecretKey::from_bytes` will never fail for 32-byte inputs. * Revert changes that don’t belong in this PR * Remove using void to bypass ICE (#1295) * Publish 0.13.0 (#1294)
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,3 +1,16 @@
|
|||||||
|
# Version 0.13.0 (2019-11-05)
|
||||||
|
|
||||||
|
- Reworked the transport upgrade API. See https://github.com/libp2p/rust-libp2p/pull/1240 for more information.
|
||||||
|
- Added a parameter allowing to choose the protocol negotiation protocol when upgrading a connection or a substream. See https://github.com/libp2p/rust-libp2p/pull/1245 for more information.
|
||||||
|
- Added an alternative `multistream-select` protocol called `V1Lazy`.
|
||||||
|
- Added `PlainText2Config` that implements the `/plaintext/2.0.0` protocol.
|
||||||
|
- Refactored `libp2p-identify`. Some items have been renamed.
|
||||||
|
- Now accepting `PeerId`s using the `identity` hashing algorithm as valid.
|
||||||
|
- Removed `libp2p-observed` and `libp2p-ratelimit`.
|
||||||
|
- Fixed mDNS long peer IDs not being transmitted properly.
|
||||||
|
- Added some `Debug` trait implementations.
|
||||||
|
- Fixed potential arithmetic overflows in `libp2p-kad` and `multistream-select`.
|
||||||
|
|
||||||
# Version 0.12.0 (2019-08-15)
|
# Version 0.12.0 (2019-08-15)
|
||||||
|
|
||||||
- In some situations, `multistream-select` will now assume that protocol negotiation immediately succeeds. If it turns out that it failed, an error is generated when reading or writing from/to the stream.
|
- In some situations, `multistream-select` will now assume that protocol negotiation immediately succeeds. If it turns out that it failed, an error is generated when reading or writing from/to the stream.
|
||||||
|
48
Cargo.toml
48
Cargo.toml
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p"
|
name = "libp2p"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Peer-to-peer networking library"
|
description = "Peer-to-peer networking library"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -16,23 +16,23 @@ secp256k1 = ["libp2p-core/secp256k1", "libp2p-secio/secp256k1"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "misc/multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.1", path = "misc/multiaddr" }
|
||||||
multihash = { package = "parity-multihash", version = "0.1.0", path = "misc/multihash" }
|
multihash = { package = "parity-multihash", version = "0.1.4", path = "misc/multihash" }
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
libp2p-mplex = { version = "0.12.0", path = "muxers/mplex" }
|
libp2p-mplex = { version = "0.13.0", path = "muxers/mplex" }
|
||||||
libp2p-identify = { version = "0.12.0", path = "protocols/identify" }
|
libp2p-identify = { version = "0.13.0", path = "protocols/identify" }
|
||||||
libp2p-kad = { version = "0.12.0", path = "protocols/kad" }
|
libp2p-kad = { version = "0.13.0", path = "protocols/kad" }
|
||||||
libp2p-floodsub = { version = "0.12.0", path = "protocols/floodsub" }
|
libp2p-floodsub = { version = "0.13.0", path = "protocols/floodsub" }
|
||||||
libp2p-ping = { version = "0.12.0", path = "protocols/ping" }
|
libp2p-ping = { version = "0.13.0", path = "protocols/ping" }
|
||||||
libp2p-plaintext = { version = "0.12.0", path = "protocols/plaintext" }
|
libp2p-plaintext = { version = "0.13.0", path = "protocols/plaintext" }
|
||||||
libp2p-core = { version = "0.12.0", path = "core" }
|
libp2p-core = { version = "0.13.0", path = "core" }
|
||||||
libp2p-core-derive = { version = "0.12.0", path = "misc/core-derive" }
|
libp2p-core-derive = { version = "0.13.0", path = "misc/core-derive" }
|
||||||
libp2p-secio = { version = "0.12.0", path = "protocols/secio", default-features = false }
|
libp2p-secio = { version = "0.13.0", path = "protocols/secio", default-features = false }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "swarm" }
|
||||||
libp2p-uds = { version = "0.12.0", path = "transports/uds" }
|
libp2p-uds = { version = "0.13.0", path = "transports/uds" }
|
||||||
libp2p-wasm-ext = { version = "0.5.0", path = "transports/wasm-ext" }
|
libp2p-wasm-ext = { version = "0.6.0", path = "transports/wasm-ext" }
|
||||||
libp2p-yamux = { version = "0.12.0", path = "muxers/yamux" }
|
libp2p-yamux = { version = "0.13.0", path = "muxers/yamux" }
|
||||||
parking_lot = "0.8"
|
parking_lot = "0.9.0"
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
tokio-codec = "0.1"
|
tokio-codec = "0.1"
|
||||||
tokio-executor = "0.1"
|
tokio-executor = "0.1"
|
||||||
@ -40,15 +40,15 @@ tokio-io = "0.1"
|
|||||||
wasm-timer = "0.1"
|
wasm-timer = "0.1"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "emscripten", target_os = "unknown")))'.dependencies]
|
[target.'cfg(not(any(target_os = "emscripten", target_os = "unknown")))'.dependencies]
|
||||||
libp2p-deflate = { version = "0.4.0", path = "protocols/deflate" }
|
libp2p-deflate = { version = "0.5.0", path = "protocols/deflate" }
|
||||||
libp2p-dns = { version = "0.12.0", path = "transports/dns" }
|
libp2p-dns = { version = "0.13.0", path = "transports/dns" }
|
||||||
libp2p-mdns = { version = "0.12.0", path = "misc/mdns" }
|
libp2p-mdns = { version = "0.13.0", path = "misc/mdns" }
|
||||||
libp2p-noise = { version = "0.10.0", path = "protocols/noise" }
|
libp2p-noise = { version = "0.11.0", path = "protocols/noise" }
|
||||||
libp2p-tcp = { version = "0.12.0", path = "transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "transports/tcp" }
|
||||||
libp2p-websocket = { version = "0.12.0", path = "transports/websocket", optional = true }
|
libp2p-websocket = { version = "0.13.0", path = "transports/websocket", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.6.0"
|
env_logger = "0.7.1"
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
tokio-stdin-stdout = "0.1"
|
tokio-stdin-stdout = "0.1"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-core"
|
name = "libp2p-core"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Core traits and structs of libp2p"
|
description = "Core traits and structs of libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,22 +11,22 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
asn1_der = "0.6.1"
|
asn1_der = "0.6.1"
|
||||||
bs58 = "0.2.0"
|
bs58 = "0.3.0"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
ed25519-dalek = "1.0.0-pre.1"
|
ed25519-dalek = "1.0.0-pre.2"
|
||||||
failure = "0.1"
|
failure = "0.1"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
futures-timer = "0.3"
|
futures-timer = "0.3"
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../misc/multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../misc/multiaddr" }
|
||||||
multihash = { package = "parity-multihash", version = "0.1.0", path = "../misc/multihash" }
|
multihash = { package = "parity-multihash", version = "0.1.4", path = "../misc/multihash" }
|
||||||
multistream-select = { version = "0.5.0", path = "../misc/multistream-select" }
|
multistream-select = { version = "0.6.0", path = "../misc/multistream-select" }
|
||||||
futures-preview = { version = "0.3.0-alpha.18", features = ["compat", "io-compat"] }
|
futures-preview = { version = "0.3.0-alpha.18", features = ["compat", "io-compat"] }
|
||||||
parking_lot = "0.8"
|
parking_lot = "0.9.0"
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
quick-error = "1.2"
|
quick-error = "1.2"
|
||||||
rand = "0.6"
|
rand = "0.7"
|
||||||
rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" }
|
rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" }
|
||||||
libsecp256k1 = { version = "0.3.1", optional = true }
|
libsecp256k1 = { version = "0.3.1", optional = true }
|
||||||
sha2 = "0.8.0"
|
sha2 = "0.8.0"
|
||||||
@ -37,17 +37,17 @@ void = "1"
|
|||||||
zeroize = "1"
|
zeroize = "1"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "emscripten", target_os = "unknown")))'.dependencies]
|
[target.'cfg(not(any(target_os = "emscripten", target_os = "unknown")))'.dependencies]
|
||||||
ring = { version = "^0.16", features = ["alloc", "std"], default-features = false }
|
ring = { version = "0.16.9", features = ["alloc", "std"], default-features = false }
|
||||||
untrusted = { version = "0.6" }
|
untrusted = "0.7.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = "0.99"
|
async-std = "0.99"
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../swarm" }
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../transports/tcp" }
|
||||||
libp2p-mplex = { version = "0.12.0", path = "../muxers/mplex" }
|
libp2p-mplex = { version = "0.13.0", path = "../muxers/mplex" }
|
||||||
libp2p-secio = { version = "0.12.0", path = "../protocols/secio" }
|
libp2p-secio = { version = "0.13.0", path = "../protocols/secio" }
|
||||||
rand = "0.6"
|
rand = "0.7.2"
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
assert_matches = "1.3"
|
assert_matches = "1.3"
|
||||||
|
|
||||||
|
@ -22,8 +22,10 @@
|
|||||||
|
|
||||||
use ed25519_dalek as ed25519;
|
use ed25519_dalek as ed25519;
|
||||||
use failure::Fail;
|
use failure::Fail;
|
||||||
|
use rand::RngCore;
|
||||||
use super::error::DecodingError;
|
use super::error::DecodingError;
|
||||||
use zeroize::Zeroize;
|
use zeroize::Zeroize;
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
/// An Ed25519 keypair.
|
/// An Ed25519 keypair.
|
||||||
pub struct Keypair(ed25519::Keypair);
|
pub struct Keypair(ed25519::Keypair);
|
||||||
@ -31,7 +33,7 @@ pub struct Keypair(ed25519::Keypair);
|
|||||||
impl Keypair {
|
impl Keypair {
|
||||||
/// Generate a new Ed25519 keypair.
|
/// Generate a new Ed25519 keypair.
|
||||||
pub fn generate() -> Keypair {
|
pub fn generate() -> Keypair {
|
||||||
Keypair(ed25519::Keypair::generate(&mut rand::thread_rng()))
|
Keypair::from(SecretKey::generate())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encode the keypair into a byte array by concatenating the bytes
|
/// Encode the keypair into a byte array by concatenating the bytes
|
||||||
@ -66,6 +68,12 @@ impl Keypair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Keypair {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("Keypair").field("public", &self.0.public).finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Clone for Keypair {
|
impl Clone for Keypair {
|
||||||
fn clone(&self) -> Keypair {
|
fn clone(&self) -> Keypair {
|
||||||
let mut sk_bytes = self.0.secret.to_bytes();
|
let mut sk_bytes = self.0.secret.to_bytes();
|
||||||
@ -87,9 +95,9 @@ impl From<Keypair> for SecretKey {
|
|||||||
/// Promote an Ed25519 secret key into a keypair.
|
/// Promote an Ed25519 secret key into a keypair.
|
||||||
impl From<SecretKey> for Keypair {
|
impl From<SecretKey> for Keypair {
|
||||||
fn from(sk: SecretKey) -> Keypair {
|
fn from(sk: SecretKey) -> Keypair {
|
||||||
let secret = sk.0;
|
let secret: ed25519::ExpandedSecretKey = (&sk.0).into();
|
||||||
let public = ed25519::PublicKey::from(&secret);
|
let public = ed25519::PublicKey::from(&secret);
|
||||||
Keypair(ed25519::Keypair { secret, public })
|
Keypair(ed25519::Keypair { secret: sk.0, public })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,10 +143,19 @@ impl Clone for SecretKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for SecretKey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "SecretKey")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SecretKey {
|
impl SecretKey {
|
||||||
/// Generate a new Ed25519 secret key.
|
/// Generate a new Ed25519 secret key.
|
||||||
pub fn generate() -> SecretKey {
|
pub fn generate() -> SecretKey {
|
||||||
SecretKey(ed25519::SecretKey::generate(&mut rand::thread_rng()))
|
let mut bytes = [0u8; 32];
|
||||||
|
rand::thread_rng().fill_bytes(&mut bytes);
|
||||||
|
SecretKey(ed25519::SecretKey::from_bytes(&bytes)
|
||||||
|
.expect("this returns `Err` only if the length is wrong; the length is correct; qed"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an Ed25519 secret key from a byte slice, zeroing the input on success.
|
/// Create an Ed25519 secret key from a byte slice, zeroing the input on success.
|
||||||
|
@ -26,6 +26,7 @@ use sha2::{Digest as ShaDigestTrait, Sha256};
|
|||||||
use secp256k1::{Message, Signature};
|
use secp256k1::{Message, Signature};
|
||||||
use super::error::{DecodingError, SigningError};
|
use super::error::{DecodingError, SigningError};
|
||||||
use zeroize::Zeroize;
|
use zeroize::Zeroize;
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
/// A Secp256k1 keypair.
|
/// A Secp256k1 keypair.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -51,6 +52,12 @@ impl Keypair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Keypair {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("Keypair").field("public", &self.public).finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Promote a Secp256k1 secret key into a keypair.
|
/// Promote a Secp256k1 secret key into a keypair.
|
||||||
impl From<SecretKey> for Keypair {
|
impl From<SecretKey> for Keypair {
|
||||||
fn from(secret: SecretKey) -> Keypair {
|
fn from(secret: SecretKey) -> Keypair {
|
||||||
@ -70,6 +77,12 @@ impl From<Keypair> for SecretKey {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SecretKey(secp256k1::SecretKey);
|
pub struct SecretKey(secp256k1::SecretKey);
|
||||||
|
|
||||||
|
impl fmt::Debug for SecretKey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "SecretKey")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SecretKey {
|
impl SecretKey {
|
||||||
/// Generate a new Secp256k1 secret key.
|
/// Generate a new Secp256k1 secret key.
|
||||||
pub fn generate() -> SecretKey {
|
pub fn generate() -> SecretKey {
|
||||||
|
@ -26,6 +26,8 @@ use std::{convert::TryFrom, fmt, str::FromStr};
|
|||||||
|
|
||||||
/// Public keys with byte-lengths smaller than `MAX_INLINE_KEY_LENGTH` will be
|
/// Public keys with byte-lengths smaller than `MAX_INLINE_KEY_LENGTH` will be
|
||||||
/// automatically used as the peer id using an identity multihash.
|
/// automatically used as the peer id using an identity multihash.
|
||||||
|
//
|
||||||
|
// Note: see `from_public_key` for how this value will be used in the future.
|
||||||
const MAX_INLINE_KEY_LENGTH: usize = 42;
|
const MAX_INLINE_KEY_LENGTH: usize = 42;
|
||||||
|
|
||||||
/// Identifier of a peer of the network.
|
/// Identifier of a peer of the network.
|
||||||
@ -98,7 +100,7 @@ impl PeerId {
|
|||||||
/// returns back the data as an error.
|
/// returns back the data as an error.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_multihash(data: multihash::Multihash) -> Result<PeerId, multihash::Multihash> {
|
pub fn from_multihash(data: multihash::Multihash) -> Result<PeerId, multihash::Multihash> {
|
||||||
if data.algorithm() == multihash::Hash::SHA2256 {
|
if data.algorithm() == multihash::Hash::SHA2256 || data.algorithm() == multihash::Hash::Identity {
|
||||||
Ok(PeerId { multihash: data })
|
Ok(PeerId { multihash: data })
|
||||||
} else {
|
} else {
|
||||||
Err(data)
|
Err(data)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-core-derive"
|
name = "libp2p-core-derive"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Procedural macros of libp2p-core"
|
description = "Procedural macros of libp2p-core"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -17,4 +17,4 @@ syn = { version = "0.15.22", default-features = false, features = ["clone-impls"
|
|||||||
quote = "0.6"
|
quote = "0.6"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p = { version = "0.12.0", path = "../.." }
|
libp2p = { version = "0.13.0", path = "../.." }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libp2p-mdns"
|
name = "libp2p-mdns"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
description = "Implementation of the libp2p mDNS discovery method"
|
description = "Implementation of the libp2p mDNS discovery method"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -14,8 +14,8 @@ async-std = "0.99"
|
|||||||
data-encoding = "2.0"
|
data-encoding = "2.0"
|
||||||
dns-parser = "0.8"
|
dns-parser = "0.8"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../multiaddr" }
|
||||||
net2 = "0.2"
|
net2 = "0.2"
|
||||||
|
@ -27,6 +27,9 @@ use libp2p_core::{Multiaddr, PeerId};
|
|||||||
use rand;
|
use rand;
|
||||||
use std::{borrow::Cow, cmp, error, fmt, str, time::Duration};
|
use std::{borrow::Cow, cmp, error, fmt, str, time::Duration};
|
||||||
|
|
||||||
|
/// Maximum size of a DNS label as per RFC1035
|
||||||
|
const MAX_LABEL_LENGTH: usize = 63;
|
||||||
|
|
||||||
/// Decodes a `<character-string>` (as defined by RFC1035) into a `Vec` of ASCII characters.
|
/// Decodes a `<character-string>` (as defined by RFC1035) into a `Vec` of ASCII characters.
|
||||||
// TODO: better error type?
|
// TODO: better error type?
|
||||||
pub fn decode_character_string(mut from: &[u8]) -> Result<Cow<'_, [u8]>, ()> {
|
pub fn decode_character_string(mut from: &[u8]) -> Result<Cow<'_, [u8]>, ()> {
|
||||||
@ -117,23 +120,15 @@ pub fn build_query_response(
|
|||||||
// TTL for the answer
|
// TTL for the answer
|
||||||
append_u32(&mut out, ttl);
|
append_u32(&mut out, ttl);
|
||||||
|
|
||||||
let peer_id_base58 = peer_id.to_base58();
|
|
||||||
|
|
||||||
// Peer Id.
|
// Peer Id.
|
||||||
let peer_name = format!(
|
let peer_id_bytes = encode_peer_id(&peer_id);
|
||||||
"{}.{}",
|
|
||||||
data_encoding::BASE32_DNSCURVE.encode(&peer_id.into_bytes()),
|
|
||||||
str::from_utf8(SERVICE_NAME).expect("SERVICE_NAME is always ASCII")
|
|
||||||
);
|
|
||||||
let mut peer_id_bytes = Vec::with_capacity(64);
|
|
||||||
append_qname(&mut peer_id_bytes, peer_name.as_bytes());
|
|
||||||
debug_assert!(peer_id_bytes.len() <= 0xffff);
|
debug_assert!(peer_id_bytes.len() <= 0xffff);
|
||||||
append_u16(&mut out, peer_id_bytes.len() as u16);
|
append_u16(&mut out, peer_id_bytes.len() as u16);
|
||||||
out.extend_from_slice(&peer_id_bytes);
|
out.extend_from_slice(&peer_id_bytes);
|
||||||
|
|
||||||
// The TXT records for answers.
|
// The TXT records for answers.
|
||||||
for addr in addresses {
|
for addr in addresses {
|
||||||
let txt_to_send = format!("dnsaddr={}/p2p/{}", addr.to_string(), peer_id_base58);
|
let txt_to_send = format!("dnsaddr={}/p2p/{}", addr.to_string(), peer_id.to_base58());
|
||||||
let mut txt_to_send_bytes = Vec::with_capacity(txt_to_send.len());
|
let mut txt_to_send_bytes = Vec::with_capacity(txt_to_send.len());
|
||||||
append_character_string(&mut txt_to_send_bytes, txt_to_send.as_bytes())?;
|
append_character_string(&mut txt_to_send_bytes, txt_to_send.as_bytes())?;
|
||||||
append_txt_record(&mut out, &peer_id_bytes, ttl, Some(&txt_to_send_bytes[..]))?;
|
append_txt_record(&mut out, &peer_id_bytes, ttl, Some(&txt_to_send_bytes[..]))?;
|
||||||
@ -177,7 +172,7 @@ pub fn build_service_discovery_response(id: u16, ttl: Duration) -> Vec<u8> {
|
|||||||
|
|
||||||
// Service name.
|
// Service name.
|
||||||
{
|
{
|
||||||
let mut name = Vec::new();
|
let mut name = Vec::with_capacity(SERVICE_NAME.len() + 2);
|
||||||
append_qname(&mut name, SERVICE_NAME);
|
append_qname(&mut name, SERVICE_NAME);
|
||||||
append_u16(&mut out, name.len() as u16);
|
append_u16(&mut out, name.len() as u16);
|
||||||
out.extend_from_slice(&name);
|
out.extend_from_slice(&name);
|
||||||
@ -211,6 +206,40 @@ fn append_u16(out: &mut Vec<u8>, value: u16) {
|
|||||||
out.push((value & 0xff) as u8);
|
out.push((value & 0xff) as u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If a peer ID is longer than 63 characters, split it into segments to
|
||||||
|
/// be compatible with RFC 1035.
|
||||||
|
fn segment_peer_id(peer_id: String) -> String {
|
||||||
|
// Guard for the most common case
|
||||||
|
if peer_id.len() <= MAX_LABEL_LENGTH { return peer_id }
|
||||||
|
|
||||||
|
// This will only perform one allocation except in extreme circumstances.
|
||||||
|
let mut out = String::with_capacity(peer_id.len() + 8);
|
||||||
|
|
||||||
|
for (idx, chr) in peer_id.chars().enumerate() {
|
||||||
|
if idx > 0 && idx % MAX_LABEL_LENGTH == 0 {
|
||||||
|
out.push('.');
|
||||||
|
}
|
||||||
|
out.push(chr);
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Combines and encodes a `PeerId` and service name for a DNS query.
|
||||||
|
fn encode_peer_id(peer_id: &PeerId) -> Vec<u8> {
|
||||||
|
// DNS-safe encoding for the Peer ID
|
||||||
|
let raw_peer_id = data_encoding::BASE32_DNSCURVE.encode(&peer_id.as_bytes());
|
||||||
|
// ensure we don't have any labels over 63 bytes long
|
||||||
|
let encoded_peer_id = segment_peer_id(raw_peer_id);
|
||||||
|
let service_name = str::from_utf8(SERVICE_NAME).expect("SERVICE_NAME is always ASCII");
|
||||||
|
let peer_name = [&encoded_peer_id, service_name].join(".");
|
||||||
|
|
||||||
|
// allocate with a little extra padding for QNAME encoding
|
||||||
|
let mut peer_id_bytes = Vec::with_capacity(peer_name.len() + 32);
|
||||||
|
append_qname(&mut peer_id_bytes, peer_name.as_bytes());
|
||||||
|
|
||||||
|
peer_id_bytes
|
||||||
|
}
|
||||||
|
|
||||||
/// Appends a `QNAME` (as defined by RFC1035) to the `Vec`.
|
/// Appends a `QNAME` (as defined by RFC1035) to the `Vec`.
|
||||||
///
|
///
|
||||||
/// # Panic
|
/// # Panic
|
||||||
@ -223,7 +252,7 @@ fn append_qname(out: &mut Vec<u8>, name: &[u8]) {
|
|||||||
debug_assert!(name.is_ascii());
|
debug_assert!(name.is_ascii());
|
||||||
|
|
||||||
for element in name.split(|&c| c == b'.') {
|
for element in name.split(|&c| c == b'.') {
|
||||||
assert!(element.len() < 256, "Service name has a label too long");
|
assert!(element.len() < 64, "Service name has a label too long");
|
||||||
assert_ne!(element.len(), 0, "Service name contains zero length label");
|
assert_ne!(element.len(), 0, "Service name contains zero length label");
|
||||||
out.push(element.len() as u8);
|
out.push(element.len() as u8);
|
||||||
for chr in element.iter() {
|
for chr in element.iter() {
|
||||||
@ -367,5 +396,21 @@ mod tests {
|
|||||||
assert!(Packet::parse(&query).is_ok());
|
assert!(Packet::parse(&query).is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_segment_peer_id() {
|
||||||
|
let str_32 = String::from_utf8(vec![b'x'; 32]).unwrap();
|
||||||
|
let str_63 = String::from_utf8(vec![b'x'; 63]).unwrap();
|
||||||
|
let str_64 = String::from_utf8(vec![b'x'; 64]).unwrap();
|
||||||
|
let str_126 = String::from_utf8(vec![b'x'; 126]).unwrap();
|
||||||
|
let str_127 = String::from_utf8(vec![b'x'; 127]).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(segment_peer_id(str_32.clone()), str_32);
|
||||||
|
assert_eq!(segment_peer_id(str_63.clone()), str_63);
|
||||||
|
|
||||||
|
assert_eq!(segment_peer_id(str_64), [&str_63, "x"].join("."));
|
||||||
|
assert_eq!(segment_peer_id(str_126), [&str_63, str_63.as_str()].join("."));
|
||||||
|
assert_eq!(segment_peer_id(str_127), [&str_63, &str_63, "x"].join("."));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: test limits and errors
|
// TODO: test limits and errors
|
||||||
}
|
}
|
||||||
|
@ -394,18 +394,14 @@ impl<'a> MdnsResponse<'a> {
|
|||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let peer_name = {
|
let mut peer_name = match record_value.rsplitn(4, |c| c == '.').last() {
|
||||||
let mut iter = record_value.splitn(2, |c| c == '.');
|
Some(n) => n.to_owned(),
|
||||||
let name = match iter.next() {
|
None => return None,
|
||||||
Some(n) => n.to_owned(),
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
if iter.next().map(|v| v.as_bytes()) != Some(SERVICE_NAME) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// if we have a segmented name, remove the '.'
|
||||||
|
peer_name.retain(|c| c != '.');
|
||||||
|
|
||||||
let peer_id = match data_encoding::BASE32_DNSCURVE.decode(peer_name.as_bytes()) {
|
let peer_id = match data_encoding::BASE32_DNSCURVE.decode(peer_name.as_bytes()) {
|
||||||
Ok(bytes) => match PeerId::from_bytes(bytes) {
|
Ok(bytes) => match PeerId::from_bytes(bytes) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
@ -524,11 +520,10 @@ mod tests {
|
|||||||
use libp2p_core::PeerId;
|
use libp2p_core::PeerId;
|
||||||
use std::{io, task::Poll, time::Duration};
|
use std::{io, task::Poll, time::Duration};
|
||||||
use crate::service::{MdnsPacket, MdnsService};
|
use crate::service::{MdnsPacket, MdnsService};
|
||||||
|
use multiaddr::multihash::*;
|
||||||
|
|
||||||
#[test]
|
fn discover(peer_id: PeerId) {
|
||||||
fn discover_ourselves() {
|
|
||||||
let mut service = MdnsService::new().unwrap();
|
let mut service = MdnsService::new().unwrap();
|
||||||
let peer_id = PeerId::random();
|
|
||||||
let stream = stream::poll_fn(move |cx| -> Poll<Option<Result<(), io::Error>>> {
|
let stream = stream::poll_fn(move |cx| -> Poll<Option<Result<(), io::Error>>> {
|
||||||
loop {
|
loop {
|
||||||
let packet = match service.poll(cx) {
|
let packet = match service.poll(cx) {
|
||||||
@ -558,4 +553,16 @@ mod tests {
|
|||||||
.for_each(|_| future::ready(())),
|
.for_each(|_| future::ready(())),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn discover_normal_peer_id() {
|
||||||
|
discover(PeerId::random())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn discover_long_peer_id() {
|
||||||
|
let max_value = String::from_utf8(vec![b'f'; 42]).unwrap();
|
||||||
|
let hash = encode(Hash::Identity, max_value.as_ref()).unwrap();
|
||||||
|
discover(PeerId::from_multihash(hash).unwrap())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,15 @@ description = "Implementation of the multiaddr format"
|
|||||||
homepage = "https://github.com/libp2p/rust-libp2p"
|
homepage = "https://github.com/libp2p/rust-libp2p"
|
||||||
keywords = ["multiaddr", "ipfs"]
|
keywords = ["multiaddr", "ipfs"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayref = "0.3"
|
arrayref = "0.3"
|
||||||
bs58 = "0.2.0"
|
bs58 = "0.3.0"
|
||||||
byteorder = "1.3.1"
|
byteorder = "1.3.1"
|
||||||
bytes = "0.4.12"
|
bytes = "0.4.12"
|
||||||
data-encoding = "2.1"
|
data-encoding = "2.1"
|
||||||
multihash = { package = "parity-multihash", version = "0.1.0", path = "../multihash" }
|
multihash = { package = "parity-multihash", version = "0.1.4", path = "../multihash" }
|
||||||
percent-encoding = "2.1.0"
|
percent-encoding = "2.1.0"
|
||||||
serde = "1.0.70"
|
serde = "1.0.70"
|
||||||
unsigned-varint = "0.2"
|
unsigned-varint = "0.2"
|
||||||
@ -22,8 +22,8 @@ url = { version = "2.1.0", default-features = false }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bincode = "1"
|
bincode = "1"
|
||||||
bs58 = "0.2.0"
|
bs58 = "0.3.0"
|
||||||
data-encoding = "2"
|
data-encoding = "2"
|
||||||
quickcheck = "0.8.1"
|
quickcheck = "0.9.0"
|
||||||
rand = "0.6.5"
|
rand = "0.7.2"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -4,7 +4,7 @@ edition = "2018"
|
|||||||
description = "Implementation of the multihash format"
|
description = "Implementation of the multihash format"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
keywords = ["multihash", "ipfs"]
|
keywords = ["multihash", "ipfs"]
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
authors = ["dignifiedquire <dignifiedquire@gmail.com>", "Parity Technologies <admin@parity.io>"]
|
authors = ["dignifiedquire <dignifiedquire@gmail.com>", "Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
documentation = "https://docs.rs/parity-multihash/"
|
documentation = "https://docs.rs/parity-multihash/"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "multistream-select"
|
name = "multistream-select"
|
||||||
description = "Multistream-select negotiation protocol for libp2p"
|
description = "Multistream-select negotiation protocol for libp2p"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,14 +11,14 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures = { version = "0.1" }
|
futures = "0.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
unsigned-varint = { version = "0.2.2" }
|
unsigned-varint = "0.2.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
tokio-tcp = "0.1"
|
tokio-tcp = "0.1"
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
rand = "0.6"
|
rand = "0.7.2"
|
||||||
|
@ -11,5 +11,5 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
num_cpus = "1.8"
|
num_cpus = "1.8"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-mplex"
|
name = "libp2p-mplex"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Mplex multiplexing protocol for libp2p"
|
description = "Mplex multiplexing protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -14,10 +14,10 @@ bytes = "0.4.5"
|
|||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
futures_codec = "0.3.0"
|
futures_codec = "0.3.0"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
parking_lot = "0.8"
|
parking_lot = "0.8"
|
||||||
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-yamux"
|
name = "libp2p-yamux"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Yamux multiplexing protocol for libp2p"
|
description = "Yamux multiplexing protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
yamux = "0.2.1"
|
yamux = "0.2.1"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-deflate"
|
name = "libp2p-deflate"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Deflate encryption protocol for libp2p"
|
description = "Deflate encryption protocol for libp2p"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,12 +11,12 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = "0.99"
|
async-std = "0.99"
|
||||||
env_logger = "0.6"
|
env_logger = "0.7.1"
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-floodsub"
|
name = "libp2p-floodsub"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Floodsub protocol for libp2p"
|
description = "Floodsub protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -10,13 +10,13 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bs58 = "0.2.0"
|
bs58 = "0.3.0"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
cuckoofilter = "0.3.2"
|
cuckoofilter = "0.3.2"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
smallvec = "0.6.5"
|
smallvec = "0.6.5"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-identify"
|
name = "libp2p-identify"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Nodes identifcation protocol for libp2p"
|
description = "Nodes identifcation protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -13,18 +13,17 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures_codec = "0.3.0"
|
futures_codec = "0.3.0"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
||||||
void = "1.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-mplex = { version = "0.12.0", path = "../../muxers/mplex" }
|
libp2p-mplex = { version = "0.13.0", path = "../../muxers/mplex" }
|
||||||
libp2p-secio = { version = "0.12.0", path = "../../protocols/secio" }
|
libp2p-secio = { version = "0.13.0", path = "../../protocols/secio" }
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
|
@ -36,7 +36,6 @@ use libp2p_swarm::{
|
|||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{marker::PhantomData, pin::Pin, task::Context, task::Poll, time::Duration};
|
use std::{marker::PhantomData, pin::Pin, task::Context, task::Poll, time::Duration};
|
||||||
use wasm_timer::Delay;
|
use wasm_timer::Delay;
|
||||||
use void::Void;
|
|
||||||
|
|
||||||
/// Delay between the moment we connect and the first time we identify.
|
/// Delay between the moment we connect and the first time we identify.
|
||||||
const DELAY_TO_FIRST_ID: Duration = Duration::from_millis(500);
|
const DELAY_TO_FIRST_ID: Duration = Duration::from_millis(500);
|
||||||
@ -95,7 +94,7 @@ impl<TSubstream> ProtocolsHandler for IdentifyHandler<TSubstream>
|
|||||||
where
|
where
|
||||||
TSubstream: AsyncRead + AsyncWrite + Unpin + 'static,
|
TSubstream: AsyncRead + AsyncWrite + Unpin + 'static,
|
||||||
{
|
{
|
||||||
type InEvent = Void;
|
type InEvent = ();
|
||||||
type OutEvent = IdentifyHandlerEvent<TSubstream>;
|
type OutEvent = IdentifyHandlerEvent<TSubstream>;
|
||||||
type Error = ReadOneError;
|
type Error = ReadOneError;
|
||||||
type Substream = TSubstream;
|
type Substream = TSubstream;
|
||||||
|
@ -36,7 +36,6 @@ use libp2p_swarm::{
|
|||||||
ProtocolsHandlerUpgrErr
|
ProtocolsHandlerUpgrErr
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, collections::VecDeque, io, pin::Pin, task::Context, task::Poll};
|
use std::{collections::HashMap, collections::VecDeque, io, pin::Pin, task::Context, task::Poll};
|
||||||
use void::Void;
|
|
||||||
|
|
||||||
/// Network behaviour that automatically identifies nodes periodically, returns information
|
/// Network behaviour that automatically identifies nodes periodically, returns information
|
||||||
/// about them, and answers identify queries from other nodes.
|
/// about them, and answers identify queries from other nodes.
|
||||||
@ -52,7 +51,7 @@ pub struct Identify<TSubstream> {
|
|||||||
/// Pending replies to send.
|
/// Pending replies to send.
|
||||||
pending_replies: VecDeque<Reply<TSubstream>>,
|
pending_replies: VecDeque<Reply<TSubstream>>,
|
||||||
/// Pending events to be emitted when polled.
|
/// Pending events to be emitted when polled.
|
||||||
events: VecDeque<NetworkBehaviourAction<Void, IdentifyEvent>>,
|
events: VecDeque<NetworkBehaviourAction<(), IdentifyEvent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A pending reply to an inbound identification request.
|
/// A pending reply to an inbound identification request.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-kad"
|
name = "libp2p-kad"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Kademlia protocol for libp2p"
|
description = "Kademlia protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -10,19 +10,19 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayvec = "0.4.7"
|
arrayvec = "0.5.1"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
either = "1.5"
|
either = "1.5"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
futures_codec = "0.3.0"
|
futures_codec = "0.3.0"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
||||||
multihash = { package = "parity-multihash", version = "0.1.0", path = "../../misc/multihash" }
|
multihash = { package = "parity-multihash", version = "0.1.4", path = "../../misc/multihash" }
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
rand = "0.6.0"
|
rand = "0.7.2"
|
||||||
sha2 = "0.8.0"
|
sha2 = "0.8.0"
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
@ -31,8 +31,8 @@ unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
|||||||
void = "1.0"
|
void = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-secio = { version = "0.12.0", path = "../secio" }
|
libp2p-secio = { version = "0.13.0", path = "../secio" }
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
libp2p-yamux = { version = "0.12.0", path = "../../muxers/yamux" }
|
libp2p-yamux = { version = "0.13.0", path = "../../muxers/yamux" }
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
rand = "0.6.0"
|
rand = "0.7.2"
|
||||||
|
@ -1313,7 +1313,7 @@ where
|
|||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
// Calculate the available capacity for queries triggered by background jobs.
|
// Calculate the available capacity for queries triggered by background jobs.
|
||||||
let mut jobs_query_capacity = JOBS_MAX_QUERIES - self.queries.size();
|
let mut jobs_query_capacity = JOBS_MAX_QUERIES.saturating_sub(self.queries.size());
|
||||||
|
|
||||||
// Run the periodic provider announcement job.
|
// Run the periodic provider announcement job.
|
||||||
if let Some(mut job) = self.add_provider_job.take() {
|
if let Some(mut job) = self.add_provider_job.take() {
|
||||||
|
@ -623,3 +623,34 @@ fn add_provider() {
|
|||||||
QuickCheck::new().tests(3).quickcheck(prop as fn(_,_))
|
QuickCheck::new().tests(3).quickcheck(prop as fn(_,_))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// User code should be able to start queries beyond the internal
|
||||||
|
/// query limit for background jobs. Originally this even produced an
|
||||||
|
/// arithmetic overflow, see https://github.com/libp2p/rust-libp2p/issues/1290.
|
||||||
|
#[test]
|
||||||
|
fn exceed_jobs_max_queries() {
|
||||||
|
let (_, mut swarms) = build_nodes(1);
|
||||||
|
let num = JOBS_MAX_QUERIES + 1;
|
||||||
|
for _ in 0 .. num {
|
||||||
|
swarms[0].bootstrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_eq!(swarms[0].queries.size(), num);
|
||||||
|
|
||||||
|
current_thread::run(
|
||||||
|
future::poll_fn(move || {
|
||||||
|
for _ in 0 .. num {
|
||||||
|
// There are no other nodes, so the queries finish instantly.
|
||||||
|
if let Ok(Async::Ready(Some(e))) = swarms[0].poll() {
|
||||||
|
if let KademliaEvent::BootstrapResult(r) = e {
|
||||||
|
assert!(r.is_ok(), "Unexpected error")
|
||||||
|
} else {
|
||||||
|
panic!("Unexpected event: {:?}", e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
panic!("Expected event")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(Async::Ready(()))
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libp2p-noise"
|
name = "libp2p-noise"
|
||||||
description = "Cryptographic handshake protocol using the noise framework."
|
description = "Cryptographic handshake protocol using the noise framework."
|
||||||
version = "0.10.0"
|
version = "0.11.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -12,19 +12,19 @@ bytes = "0.4"
|
|||||||
curve25519-dalek = "1"
|
curve25519-dalek = "1"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
rand = "^0.7"
|
rand = "^0.7.2"
|
||||||
ring = { version = "^0.16", features = ["alloc"], default-features = false }
|
ring = { version = "0.16.9", features = ["alloc"], default-features = false }
|
||||||
snow = { version = "0.6.1", features = ["ring-resolver"], default-features = false }
|
snow = { version = "0.6.1", features = ["ring-resolver"], default-features = false }
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
x25519-dalek = "0.5"
|
x25519-dalek = "0.5"
|
||||||
zeroize = "1"
|
zeroize = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.6"
|
env_logger = "0.7.1"
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
sodiumoxide = "^0.2.5"
|
sodiumoxide = "^0.2.5"
|
||||||
|
@ -252,4 +252,3 @@ impl rand::RngCore for Rng {
|
|||||||
impl rand::CryptoRng for Rng {}
|
impl rand::CryptoRng for Rng {}
|
||||||
|
|
||||||
impl snow::types::Random for Rng {}
|
impl snow::types::Random for Rng {}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-ping"
|
name = "libp2p-ping"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Ping protocol for libp2p"
|
description = "Ping protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,19 +11,19 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
libp2p-swarm = { version = "0.2.0", path = "../../swarm" }
|
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
multiaddr = { package = "parity-multiaddr", version = "0.5.0", path = "../../misc/multiaddr" }
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
rand = "0.6"
|
rand = "0.7.2"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
void = "1.0"
|
void = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
libp2p-secio = { version = "0.12.0", path = "../../protocols/secio" }
|
libp2p-secio = { version = "0.13.0", path = "../../protocols/secio" }
|
||||||
libp2p-yamux = { version = "0.12.0", path = "../../muxers/yamux" }
|
libp2p-yamux = { version = "0.13.0", path = "../../muxers/yamux" }
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
tokio-tcp = "0.1"
|
tokio-tcp = "0.1"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-plaintext"
|
name = "libp2p-plaintext"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Plaintext encryption dummy protocol for libp2p"
|
description = "Plaintext encryption dummy protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -10,11 +10,11 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.6"
|
bytes = "0.4.12"
|
||||||
void = "1"
|
log = "0.4.8"
|
||||||
|
void = "1.0.2"
|
||||||
tokio-io = "0.1.12"
|
tokio-io = "0.1.12"
|
||||||
protobuf = "2.3"
|
protobuf = "2.8.1"
|
||||||
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
||||||
|
@ -32,6 +32,32 @@ mod error;
|
|||||||
mod handshake;
|
mod handshake;
|
||||||
mod pb;
|
mod pb;
|
||||||
|
|
||||||
|
/// `PlainText1Config` is an insecure connection handshake for testing purposes only.
|
||||||
|
///
|
||||||
|
/// > **Note**: Given that `PlainText1Config` has no notion of exchanging peer identity information it is not compatible
|
||||||
|
/// > with the `libp2p_core::transport::upgrade::Builder` pattern. See
|
||||||
|
/// > [`PlainText2Config`](struct.PlainText2Config.html) if compatibility is needed. Even though not compatible with the
|
||||||
|
/// > Builder pattern one can still do an upgrade *manually*:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// # use libp2p_core::transport::{ Transport, memory::MemoryTransport };
|
||||||
|
/// # use libp2p_plaintext::PlainText1Config;
|
||||||
|
/// #
|
||||||
|
/// MemoryTransport::default()
|
||||||
|
/// .and_then(move |io, endpoint| {
|
||||||
|
/// libp2p_core::upgrade::apply(
|
||||||
|
/// io,
|
||||||
|
/// PlainText1Config{},
|
||||||
|
/// endpoint,
|
||||||
|
/// libp2p_core::transport::upgrade::Version::V1,
|
||||||
|
/// )
|
||||||
|
/// })
|
||||||
|
/// .map(|plaintext, _endpoint| {
|
||||||
|
/// unimplemented!();
|
||||||
|
/// // let peer_id = somehow_derive_peer_id();
|
||||||
|
/// // return (peer_id, plaintext);
|
||||||
|
/// });
|
||||||
|
/// ```
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct PlainText1Config;
|
pub struct PlainText1Config;
|
||||||
|
|
||||||
@ -64,6 +90,8 @@ impl<C> OutboundUpgrade<C> for PlainText1Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `PlainText2Config` is an insecure connection handshake for testing purposes only, implementing
|
||||||
|
/// the libp2p plaintext connection handshake specification.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct PlainText2Config {
|
pub struct PlainText2Config {
|
||||||
pub local_public_key: identity::PublicKey,
|
pub local_public_key: identity::PublicKey,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-secio"
|
name = "libp2p-secio"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Secio encryption protocol for libp2p"
|
description = "Secio encryption protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
futures_codec = "0.3.0"
|
futures_codec = "0.3.0"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.6"
|
log = "0.4.6"
|
||||||
protobuf = "2.8"
|
protobuf = "2.8"
|
||||||
rand = "0.6.5"
|
rand = "0.6.5"
|
||||||
@ -28,8 +28,8 @@ hmac = "0.7.0"
|
|||||||
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
unsigned-varint = { version = "0.2.3", features = ["futures-codec"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
ring = { version = "^0.16", features = ["alloc"], default-features = false }
|
ring = { version = "0.16.9", features = ["alloc"], default-features = false }
|
||||||
untrusted = { version = "0.6" }
|
untrusted = "0.7.0"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
js-sys = "0.3.10"
|
js-sys = "0.3.10"
|
||||||
@ -45,9 +45,9 @@ aes-all = ["aesni"]
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = "0.99"
|
async-std = "0.99"
|
||||||
criterion = "0.2"
|
criterion = "0.3.0"
|
||||||
libp2p-mplex = { version = "0.12.0", path = "../../muxers/mplex" }
|
libp2p-mplex = { version = "0.13.0", path = "../../muxers/mplex" }
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../../transports/tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../../transports/tcp" }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "bench"
|
name = "bench"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-swarm"
|
name = "libp2p-swarm"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "The libp2p swarm"
|
description = "The libp2p swarm"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -11,12 +11,12 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
libp2p-core = { version = "0.12.0", path = "../core" }
|
libp2p-core = { version = "0.13.0", path = "../core" }
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
void = "1"
|
void = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-mplex = { version = "0.12.0", path = "../muxers/mplex" }
|
libp2p-mplex = { version = "0.13.0", path = "../muxers/mplex" }
|
||||||
quickcheck = "0.8"
|
quickcheck = "0.9.0"
|
||||||
rand = "0.6"
|
rand = "0.7.2"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-dns"
|
name = "libp2p-dns"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "DNS transport implementation for libp2p"
|
description = "DNS transport implementation for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -10,6 +10,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-tcp"
|
name = "libp2p-tcp"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "TCP/IP transport protocol for libp2p"
|
description = "TCP/IP transport protocol for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -14,7 +14,7 @@ async-std = "0.99"
|
|||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
get_if_addrs = "0.5.3"
|
get_if_addrs = "0.5.3"
|
||||||
ipnet = "2.0.0"
|
ipnet = "2.0.0"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
futures-timer = "0.3"
|
futures-timer = "0.3"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-uds"
|
name = "libp2p-uds"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Unix domain sockets transport for libp2p"
|
description = "Unix domain sockets transport for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -10,7 +10,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[target.'cfg(all(unix, not(any(target_os = "emscripten", target_os = "unknown"))))'.dependencies]
|
[target.'cfg(all(unix, not(any(target_os = "emscripten", target_os = "unknown"))))'.dependencies]
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
romio = "0.3.0-alpha.9"
|
romio = "0.3.0-alpha.9"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libp2p-wasm-ext"
|
name = "libp2p-wasm-ext"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Allows passing in an external transport in a WASM environment"
|
description = "Allows passing in an external transport in a WASM environment"
|
||||||
@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
js-sys = "0.3.19"
|
js-sys = "0.3.19"
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
parity-send-wrapper = "0.1.0"
|
parity-send-wrapper = "0.1.0"
|
||||||
wasm-bindgen = "0.2.42"
|
wasm-bindgen = "0.2.42"
|
||||||
wasm-bindgen-futures = { version = "0.3.25", features = ["futures_0_3"] }
|
wasm-bindgen-futures = { version = "0.3.25", features = ["futures_0_3"] }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "libp2p-websocket"
|
name = "libp2p-websocket"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "WebSocket transport for libp2p"
|
description = "WebSocket transport for libp2p"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
@ -14,12 +14,12 @@ bytes = "0.4.12"
|
|||||||
either = "1.5.3"
|
either = "1.5.3"
|
||||||
futures-preview = "0.3.0-alpha.18"
|
futures-preview = "0.3.0-alpha.18"
|
||||||
#futures-rustls = "0.12.0-alpha" # TODO: https://github.com/quininer/tokio-rustls/issues/51
|
#futures-rustls = "0.12.0-alpha" # TODO: https://github.com/quininer/tokio-rustls/issues/51
|
||||||
libp2p-core = { version = "0.12.0", path = "../../core" }
|
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
||||||
soketto = { git = "https://github.com/paritytech/soketto.git", branch = "develop", features = ["deflate"] }
|
soketto = { git = "https://github.com/paritytech/soketto.git", branch = "develop", features = ["deflate"] }
|
||||||
url = "2.1.0"
|
url = "2.1.0"
|
||||||
webpki-roots = "0.17.0"
|
webpki-roots = "0.18.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-tcp = { version = "0.12.0", path = "../tcp" }
|
libp2p-tcp = { version = "0.13.0", path = "../tcp" }
|
||||||
|
Reference in New Issue
Block a user