From 728f20e04f1dbfa0105d3d3515f18c610750433f Mon Sep 17 00:00:00 2001 From: Hugo-C Date: Fri, 31 Jan 2025 19:13:48 +0100 Subject: [PATCH 1/5] GH-15 # Update rand library update rstest --- Cargo.toml | 4 ++-- src/lib.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ca60938..5f054ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ exclude = [ [dependencies] pnet = "^0.35" hex = "^0.4" -rand = "^0.8" +rand = "^0.9" sha2 = "^0.10" [dev-dependencies] -rstest = "~0.22" +rstest = "~0.24" diff --git a/src/lib.rs b/src/lib.rs index 660bdff..d316a3a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,12 @@ pub mod error; -use rand::{thread_rng, Rng}; -use rand::seq::SliceRandom; +use rand::Rng; use std::str::FromStr; use sha2::{Sha256, Digest}; use std::net::{SocketAddr, TcpStream, ToSocketAddrs}; use std::io::{Write, Read}; use std::time::Duration; +use rand::seq::IndexedRandom; use crate::error::{DetailedError, JarmError}; const ALPN_EXTENSION: &[u8; 2] = b"\x00\x10"; @@ -762,8 +762,8 @@ impl JarmRng for TestRng { // Mocked Rng used in tests impl JarmRng for PseudoRng { // Real Rng used outside of tests fn random_bytes(&self) -> Vec { - let mut rng = thread_rng(); - rng.gen::<[u8; 32]>().to_vec() + let mut rng = rand::rng(); + rng.random::<[u8; 32]>().to_vec() } fn random_grease(&self) -> Vec { @@ -785,7 +785,7 @@ impl JarmRng for PseudoRng { // Real Rng used outside of tests b"\xea\xea".to_vec(), b"\xfa\xfa".to_vec(), ]; - grease_list.choose(&mut rand::thread_rng()).unwrap().clone() + grease_list.choose(&mut rand::rng()).unwrap().clone() } } From 341b6356a00daf22580cc4447ce1c6367db71c97 Mon Sep 17 00:00:00 2001 From: Hugo-C Date: Fri, 31 Jan 2025 19:17:37 +0100 Subject: [PATCH 2/5] GH-15 # Drop pnet library library seems to never have been used --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5f054ed..e14055f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ exclude = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pnet = "^0.35" hex = "^0.4" rand = "^0.9" sha2 = "^0.10" From b316c29a47e7b76e3ce6be1073632e40d79ff21b Mon Sep 17 00:00:00 2001 From: Hugo-C Date: Fri, 31 Jan 2025 19:29:14 +0100 Subject: [PATCH 3/5] GH-15 # Update codecov-action --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e711f75..5170e5b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,7 +23,7 @@ jobs: - name: Generate code coverage run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml - name: Upload coverage report to codecov.io - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} # required fail_ci_if_error: true From e6296f1459858262ae6f41653fe5863c0aa2090a Mon Sep 17 00:00:00 2001 From: Hugo-C Date: Fri, 31 Jan 2025 19:32:43 +0100 Subject: [PATCH 4/5] GH-15 # Ignore coverage of PseudoRng --- Cargo.toml | 3 +++ src/lib.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index e14055f..46516cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,3 +20,6 @@ sha2 = "^0.10" [dev-dependencies] rstest = "~0.24" + +[lints.rust] + unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index d316a3a..f8411c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -760,6 +760,7 @@ impl JarmRng for TestRng { // Mocked Rng used in tests } } +#[cfg(not(tarpaulin_include))] // disable coverage impl JarmRng for PseudoRng { // Real Rng used outside of tests fn random_bytes(&self) -> Vec { let mut rng = rand::rng(); From 37a5c2c1a955bc99b7cf5cca96358b3bd1a3bbf6 Mon Sep 17 00:00:00 2001 From: Hugo-C Date: Fri, 31 Jan 2025 19:55:35 +0100 Subject: [PATCH 5/5] GH-15 # Bump to 0.3.7 --- Cargo.toml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46516cd..8a9bb31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust_jarm" -version = "0.3.6" +version = "0.3.7" authors = ["Hugo-C"] edition = "2021" license = "MIT" diff --git a/README.md b/README.md index 177cfda..33e8fe5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ rust_jarm is a library to compute JARM fingerprint. It is more or less a direct put in Cargo.toml: ``` [dependencies] -rust_jarm = "0.3.6" +rust_jarm = "0.3.7" ``` ## Usage