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 diff --git a/Cargo.toml b/Cargo.toml index ca60938..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" @@ -14,10 +14,12 @@ 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.8" +rand = "^0.9" sha2 = "^0.10" [dev-dependencies] -rstest = "~0.22" +rstest = "~0.24" + +[lints.rust] + unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } \ No newline at end of file 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 diff --git a/src/lib.rs b/src/lib.rs index 660bdff..f8411c9 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"; @@ -760,10 +760,11 @@ 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 = 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 +786,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() } }