Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust_jarm"
version = "0.3.6"
version = "0.3.7"
authors = ["Hugo-C"]
edition = "2021"
license = "MIT"
Expand All @@ -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)'] }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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<u8> {
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<u8> {
Expand All @@ -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()
}
}

Expand Down