Skip to content

Commit

Permalink
chore: bump to 0.6.0 (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Jun 12, 2024
1 parent 277cd87 commit 86e442a
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 33 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## secio 0.6.2 tentacle 0.6.0

### Features
- upgrade dependences
- impl Display for PeerId

## secio 0.6.1

### Features
Expand Down
6 changes: 3 additions & 3 deletions multiaddr/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tentacle-multiaddr"
version = "0.3.3"
version = "0.3.4"
authors = ["driftluo <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -9,9 +9,9 @@ description = "Mini Implementation of multiaddr"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
unsigned-varint = "0.7"
unsigned-varint = "0.8"
bytes = "1.0"
bs58 = "0.4.0"
bs58 = "0.5.0"
sha2 = "0.10.0"
serde = "1"

Expand Down
30 changes: 16 additions & 14 deletions secio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tentacle-secio"
version = "0.6.1"
version = "0.6.2"
license = "MIT"
description = "Secio encryption protocol for p2p"
authors = ["piaoliu <[email protected]>", "Nervos Core Dev <[email protected]>"]
Expand All @@ -23,28 +23,30 @@ tokio-util = { version = "0.7.0", features = ["codec"] }
log = "0.4.1"
async-trait = { version = "0.1", optional = true }

molecule = "0.7.0"
molecule = "0.8.0"

unsigned-varint = "0.7"
bs58 = "0.4.0"
secp256k1 = "0.24"
unsigned-varint = "0.8"
bs58 = "0.5.0"
secp256k1 = "0.29"
rand = "0.8"

[target.'cfg(unix)'.dependencies]
openssl = "0.10.25"
openssl-sys = "0.9"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
rand = "0.8"
ring = "0.16.5"
ring = "0.17"

[target.'cfg(target_arch = "wasm32")'.dependencies]
# wait x25519-dalek upgrade rand core
rand_core = { version = "0.5" }
rand = { version = "0.7", features = ["wasm-bindgen"] }
rand_core = { version = "0.6" }
getrandom = { version = "0.2", features = ["js"] }
sha2 = "0.10.0"
hmac = "0.12.0"
x25519-dalek = "1.1"
chacha20poly1305 = { version = "0.10", default-features = false, features = ["alloc", "rand_core"]}
x25519-dalek = { version = "2" }
chacha20poly1305 = { version = "0.10", default-features = false, features = [
"alloc",
"rand_core",
] }

[features]
openssl-vendored = ["openssl/vendored"]
Expand All @@ -55,9 +57,9 @@ criterion = "0.3"
tokio = { version = "1.0.0", features = ["net", "rt", "rt-multi-thread"] }
sha2 = "0.10.0"
hmac = "0.12.0"
x25519-dalek = "1.1"
x25519-dalek = "2"
chacha20poly1305 = "0.10"
rand_core = { version = "0.5" }
rand_core = { version = "0.6" }
once_cell = "1.8.0"
proptest = "1"

Expand Down
2 changes: 1 addition & 1 deletion secio/src/codec/hmac_compat/ring_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl Hmac {
#[cfg(test)]
#[inline]
pub fn num_bytes(&self) -> usize {
self.0.algorithm().digest_algorithm().output_len
self.0.algorithm().digest_algorithm().output_len()
}

/// Builds a `Hmac` from an algorithm and key.
Expand Down
5 changes: 3 additions & 2 deletions secio/src/dh_compat/ring_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use ring::rand as ring_rand;

use super::KeyAgreement;
use crate::error::SecioError;
#[allow(unused_imports)]
pub use ring::agreement::EphemeralPrivateKey;

impl From<KeyAgreement> for &'static agreement::Algorithm {
Expand Down Expand Up @@ -50,7 +51,7 @@ pub fn agree(
agreement::agree_ephemeral(
my_private_key,
&agreement::UnparsedPublicKey::new(algorithm.into(), other_public_key),
SecioError::SecretGenerationFailed,
|key_material| Ok(key_material.to_vec()),
|key_material| key_material.to_vec(),
)
.map_err(|_| SecioError::SecretGenerationFailed)
}
2 changes: 1 addition & 1 deletion secio/src/dh_compat/wasm_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn generate_agreement(
) -> Result<(EphemeralPrivateKey, Vec<u8>), SecioError> {
match algorithm {
KeyAgreement::X25519 => {
let key = EphemeralPrivateKey::new(OsRng);
let key = EphemeralPrivateKey::random_from_rng(OsRng);
let pubkey = PublicKey::from(&key);
Ok((key, pubkey.to_bytes().to_vec()))
}
Expand Down
2 changes: 1 addition & 1 deletion secio/src/secp256k1_compat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn pubkey_from_slice(key: &[u8]) -> Result<PublicKey, secp256k1::Error> {
}

pub fn message_from_slice(msg: &[u8]) -> Result<Message, secp256k1::Error> {
Message::from_slice(msg)
Message::from_digest_slice(msg)
}

pub fn signature_from_der(data: &[u8]) -> Result<Signature, secp256k1::Error> {
Expand Down
4 changes: 2 additions & 2 deletions simple_wasm/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ impl ServiceHandle for SHandle {
/// Proto 2 open failure
///
/// Because server only supports 0,1
fn create_client() -> Service<SHandle> {
fn create_client() -> Service<SHandle, SecioKeyPair> {
ServiceBuilder::default()
.insert_protocol(create_meta(0.into()))
.insert_protocol(create_meta(1.into()))
.insert_protocol(create_meta(2.into()))
.key_pair(SecioKeyPair::secp256k1_generated())
.handshake_type(SecioKeyPair::secp256k1_generated().into())
.build(SHandle)
}

Expand Down
23 changes: 14 additions & 9 deletions tentacle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tentacle"
version = "0.5.0-alpha.1"
version = "0.6.0"
license = "MIT"
description = "Minimal implementation for a multiplexed p2p network framework."
authors = ["piaoliu <[email protected]>", "Nervos Core Dev <[email protected]>"]
Expand All @@ -11,14 +11,14 @@ categories = ["network-programming", "asynchronous"]
edition = "2021"

[package.metadata.docs.rs]
features = [ "tokio-runtime", "tokio-timer", "upnp", "ws", "unstable", "tls" ]
features = ["tokio-runtime", "tokio-timer", "upnp", "ws", "unstable", "tls"]
all-features = false
no-default-features = true
rustc-args = ["--cfg", "docsrs"]

[dependencies]
yamux = { path = "../yamux", version = "0.3.0", default-features = false, package = "tokio-yamux"}
secio = { path = "../secio", version = "0.6.0", package = "tentacle-secio" }
yamux = { path = "../yamux", version = "0.3.0", default-features = false, package = "tokio-yamux" }
secio = { path = "../secio", version = "0.6.2", package = "tentacle-secio" }

futures = { version = "0.3.0" }
tokio = { version = "1.0.0", features = ["macros"] }
Expand All @@ -31,13 +31,13 @@ once_cell = "1.0"
nohash-hasher = "0.2"

parking_lot = { version = "0.12", optional = true }
tokio-tungstenite = { version = "0.16", optional = true }
tokio-tungstenite = { version = "0.21", optional = true }
futures-timer = { version = "3.0.2", optional = true }
async-std = { version = "1", features = ["unstable"], optional = true }
async-io = { version = "1", optional = true }

multiaddr = { path = "../multiaddr", package = "tentacle-multiaddr", version = "0.3.0" }
molecule = "0.7.0"
multiaddr = { path = "../multiaddr", package = "tentacle-multiaddr", version = "0.3.4" }
molecule = "0.8.0"

# upnp
igd = { version = "0.12", optional = true }
Expand All @@ -48,7 +48,7 @@ tokio-rustls = { version = "0.24.0", optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# rand 0.8 not support wasm32
rand = "0.8"
socket2 = { version = "0.4.0", features = ["all"] }
socket2 = { version = "0.5.0", features = ["all"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"
Expand All @@ -59,7 +59,12 @@ wasm-bindgen-futures = "0.4"
libc = "0.2"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["minwindef", "ws2def", "winerror", "heapapi"]}
winapi = { version = "0.3.7", features = [
"minwindef",
"ws2def",
"winerror",
"heapapi",
] }

[dev-dependencies]
env_logger = "0.6.0"
Expand Down
1 change: 1 addition & 0 deletions tentacle/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod sink_impl;
mod tests;
mod unbound;

#[allow(unused_imports)]
pub(crate) mod mpsc {
pub use super::bound::{channel, Receiver, Sender};
pub use super::unbound::{unbounded, UnboundedReceiver, UnboundedSender};
Expand Down
1 change: 1 addition & 0 deletions tentacle/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ pub use parking_lot::{const_fair_mutex, const_mutex, const_rwlock, FairMutex, Mu
#[cfg(not(feature = "parking_lot"))]
pub mod native;

#[allow(unused_imports)]
#[cfg(not(feature = "parking_lot"))]
pub use native::{Mutex, RwLock};
2 changes: 2 additions & 0 deletions tentacle/src/transports/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ impl AsyncRead for WsStream {
}
Message::Pong(_) => Vec::new(),
Message::Text(_) => Vec::new(),
// never reach this branch
Message::Frame(_) => Vec::new(),
};

if data.is_empty() {
Expand Down

0 comments on commit 86e442a

Please sign in to comment.