Prepare for releasing 8.1.0
This commit is contained in:
parent
3fa55bdc14
commit
28332fd4b9
21 changed files with 1387 additions and 978 deletions
|
|
@ -10,4 +10,4 @@ readme = "README.md"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bytes = "1.7.1"
|
||||
bytes = "1.10"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ parking_lot = "0.12"
|
|||
tracing = "0.1"
|
||||
backoff = "0.4.0"
|
||||
futures = "0.3"
|
||||
rand = "0.8"
|
||||
rand = "0.9"
|
||||
indexmap = "2"
|
||||
dashmap = { version = "6", features = ["serde"] }
|
||||
clone_to_owned = { path = "../clone_to_owned", package = "librqbit-clone-to-owned", version = "3" }
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ impl PeerStore {
|
|||
|
||||
pub fn gen_token_for(&self, node_id: Id20, addr: SocketAddr) -> [u8; 4] {
|
||||
let mut token = [0u8; 4];
|
||||
rand::thread_rng().fill_bytes(&mut token);
|
||||
rand::rng().fill_bytes(&mut token);
|
||||
let mut tokens = self.tokens.write();
|
||||
tokens.push_back(StoredToken {
|
||||
token,
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ impl<'a> Iterator for BucketTreeIterator<'a> {
|
|||
|
||||
pub fn generate_random_id(start: &Id20, bits: u8) -> Id20 {
|
||||
let mut data = [0u8; 20];
|
||||
rand::thread_rng().fill_bytes(&mut data);
|
||||
rand::rng().fill_bytes(&mut data);
|
||||
let mut data = Id20::new(data);
|
||||
let remaining_bits = 160 - bits;
|
||||
for bit in 0..remaining_bits {
|
||||
|
|
@ -649,13 +649,13 @@ mod tests {
|
|||
|
||||
fn random_id_20() -> Id20 {
|
||||
let mut id20 = [0u8; 20];
|
||||
rand::thread_rng().fill(&mut id20);
|
||||
rand::rng().fill(&mut id20);
|
||||
Id20::new(id20)
|
||||
}
|
||||
|
||||
fn generate_socket_addr() -> SocketAddr {
|
||||
let mut ipv4_addr = [0u8; 6];
|
||||
rand::thread_rng().fill(&mut ipv4_addr);
|
||||
rand::rng().fill(&mut ipv4_addr);
|
||||
let ip = Ipv4Addr::new(ipv4_addr[0], ipv4_addr[1], ipv4_addr[2], ipv4_addr[3]);
|
||||
let port = ((ipv4_addr[4] as u16) << 8) + (ipv4_addr[5] as u16);
|
||||
SocketAddrV4::new(ip, port).into()
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ disable-upload = []
|
|||
|
||||
[dependencies]
|
||||
# sqlx and home are pinned so that we can compile on older Rusts
|
||||
sqlx = { version = "=0.8.2", features = [
|
||||
sqlx = { version = "0.8", features = [
|
||||
"runtime-tokio",
|
||||
"macros",
|
||||
"postgres",
|
||||
], default-features = false, optional = true }
|
||||
home = { version = "=0.5.5", optional = true }
|
||||
home = { version = "0.5", optional = true }
|
||||
|
||||
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3" }
|
||||
tracker_comms = { path = "../tracker_comms", default-features = false, package = "librqbit-tracker-comms", version = "2.1" }
|
||||
|
|
@ -66,7 +66,7 @@ tokio = { version = "1", features = [
|
|||
"fs",
|
||||
"io-util",
|
||||
] }
|
||||
governor = "0.8"
|
||||
governor = "0.10"
|
||||
console-subscriber = { version = "0.4", optional = true }
|
||||
axum = { version = "0.8", optional = true }
|
||||
tower-http = { version = "0.6", features = ["cors", "trace"], optional = true }
|
||||
|
|
@ -85,12 +85,12 @@ reqwest = { version = "0.12", default-features = false, features = [
|
|||
] }
|
||||
urlencoding = "2"
|
||||
byteorder = "1"
|
||||
bincode = "1"
|
||||
bincode = "2"
|
||||
bitvec = "1"
|
||||
parking_lot = "0.12"
|
||||
tracing = "0.1.40"
|
||||
size_format = "1"
|
||||
rand = "0.8"
|
||||
rand = "0.9"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = [
|
||||
"json",
|
||||
"fmt",
|
||||
|
|
@ -112,12 +112,12 @@ bytes = "1.5.0"
|
|||
rlimit = "0.10.1"
|
||||
async-stream = "0.3.5"
|
||||
memmap2 = { version = "0.9.4" }
|
||||
lru = { version = "0.12.3", optional = true }
|
||||
lru = { version = "0.14", optional = true }
|
||||
mime_guess = { version = "2.0.5", default-features = false }
|
||||
tokio-socks = "0.5.2"
|
||||
async-trait = "0.1.81"
|
||||
async-backtrace = { version = "0.2", optional = true }
|
||||
notify = { version = "7", optional = true }
|
||||
notify = { version = "8", optional = true }
|
||||
walkdir = "2.5.0"
|
||||
arc-swap = "1.7.1"
|
||||
intervaltree = "0.2.7"
|
||||
|
|
@ -127,8 +127,6 @@ async-compression = { version = "0.4.18", features = ["tokio", "gzip"] }
|
|||
anyhow = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
futures = { version = "0.3" }
|
||||
tracing-subscriber = "0.3"
|
||||
tokio-test = "0.4"
|
||||
tempfile = "3"
|
||||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
|
|
|
|||
|
|
@ -47,11 +47,7 @@ impl Blocklist {
|
|||
anyhow::bail!("Failed to fetch blocklist: HTTP {}", response.status());
|
||||
}
|
||||
|
||||
let reader = StreamReader::new(
|
||||
response
|
||||
.bytes_stream()
|
||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)),
|
||||
);
|
||||
let reader = StreamReader::new(response.bytes_stream().map_err(std::io::Error::other));
|
||||
Self::create_from_stream(reader).await
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use crate::{
|
|||
use librqbit_core::hash_id::Id20;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ReadMetainfoResult<Rx> {
|
||||
Found {
|
||||
info: TorrentMetaV1Info<ByteBufOwned>,
|
||||
|
|
|
|||
|
|
@ -358,17 +358,17 @@ impl<H: PeerConnectionHandler> PeerConnection<H> {
|
|||
use crate::tests::test_util::TestPeerMetadata;
|
||||
let tpm = TestPeerMetadata::from_peer_id(self.peer_id);
|
||||
use rand::Rng;
|
||||
if rand::thread_rng().gen_bool(tpm.disconnect_probability()) {
|
||||
if rand::rng().random_bool(tpm.disconnect_probability()) {
|
||||
bail!("disconnecting, to simulate failure in tests");
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
let sleep_ms = (rand::thread_rng().gen::<f64>()
|
||||
let sleep_ms = (rand::rng().random::<f64>()
|
||||
* (tpm.max_random_sleep_ms as f64))
|
||||
as u64;
|
||||
tokio::time::sleep(Duration::from_millis(sleep_ms)).await;
|
||||
|
||||
if rand::thread_rng().gen_bool(tpm.bad_data_probability()) {
|
||||
if rand::rng().random_bool(tpm.bad_data_probability()) {
|
||||
warn!("will NOT actually read the data to simulate a malicious peer that sends garbage");
|
||||
write_buf.fill(0);
|
||||
skip_reading_for_e2e_tests = true;
|
||||
|
|
|
|||
|
|
@ -998,11 +998,8 @@ impl Session {
|
|||
return Ok(None);
|
||||
}
|
||||
|
||||
fn check_valid(pb: &PathBuf) -> anyhow::Result<()> {
|
||||
if pb.components().into_iter().any(|x| match x {
|
||||
Component::Normal(_) => false,
|
||||
_ => true,
|
||||
}) {
|
||||
fn check_valid(pb: &Path) -> anyhow::Result<()> {
|
||||
if pb.components().any(|x| !matches!(x, Component::Normal(_))) {
|
||||
bail!("path traversal in torrent name detected")
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ async fn _test_e2e_download(drop_checks: &DropChecks) {
|
|||
async move {
|
||||
let peer_id = TestPeerMetadata {
|
||||
server_id: i,
|
||||
max_random_sleep_ms: rand::thread_rng().gen_range(0u8..16),
|
||||
max_random_sleep_ms: rand::rng().random_range(0u8..16),
|
||||
}
|
||||
.as_peer_id();
|
||||
let listen_range_start = 15100u16 + i as u16;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
use anyhow::bail;
|
||||
use librqbit_core::Id20;
|
||||
use parking_lot::RwLock;
|
||||
use rand::{thread_rng, Rng, RngCore, SeedableRng};
|
||||
use rand::{rng, Rng, RngCore, SeedableRng};
|
||||
use tempfile::TempDir;
|
||||
use tracing::{info, trace};
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ pub fn create_new_file_with_random_content(path: &Path, mut size: usize) {
|
|||
trace!(?path, "creating temp file");
|
||||
|
||||
const BUF_SIZE: usize = 8192 * 16;
|
||||
let mut rng = rand::rngs::SmallRng::from_entropy();
|
||||
let mut rng = rand::rngs::SmallRng::from_os_rng();
|
||||
let mut write_buf = [0; BUF_SIZE];
|
||||
while size > 0 {
|
||||
rng.fill_bytes(&mut write_buf[..]);
|
||||
|
|
@ -67,7 +67,7 @@ impl TestPeerMetadata {
|
|||
|
||||
pub fn as_peer_id(&self) -> Id20 {
|
||||
let mut peer_id = Id20::default();
|
||||
thread_rng().fill(&mut peer_id.0);
|
||||
rng().fill(&mut peer_id.0);
|
||||
peer_id.0[0] = self.server_id;
|
||||
peer_id.0[1] = self.max_random_sleep_ms;
|
||||
peer_id
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ impl TorrentStateInitializing {
|
|||
|
||||
// For all the remaining pieces we claim we have, validate them with decreasing probability.
|
||||
let mut queue = queue.iter_ones().collect_vec();
|
||||
queue.shuffle(&mut rand::thread_rng());
|
||||
queue.shuffle(&mut rand::rng());
|
||||
for (tmp_id, piece_id) in queue.into_iter().enumerate() {
|
||||
let denom: u32 = (tmp_id + 1).min(50).try_into().unwrap();
|
||||
if rand::thread_rng().gen_ratio(1, denom) {
|
||||
if rand::rng().random_ratio(1, denom) {
|
||||
to_validate.set(piece_id, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ impl TorrentStreams {
|
|||
|
||||
// Shuffle to decrease determinism and make queueing fairer.
|
||||
use rand::seq::SliceRandom;
|
||||
all.shuffle(&mut rand::thread_rng());
|
||||
all.shuffle(&mut rand::rng());
|
||||
|
||||
Interleave { all: all.into() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
|
|||
hex = "0.4"
|
||||
anyhow = "1"
|
||||
url = { version = "2", default-features = false }
|
||||
rand = "0.8"
|
||||
rand = "0.9"
|
||||
parking_lot = "0.12"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
buffers = { path = "../buffers", package = "librqbit-buffers", version = "4.2" }
|
||||
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3.0.1" }
|
||||
clone_to_owned = { path = "../clone_to_owned", package = "librqbit-clone-to-owned", version = "3" }
|
||||
itertools = "0.14"
|
||||
directories = "5"
|
||||
directories = "6"
|
||||
tokio-util = "0.7.10"
|
||||
data-encoding = "2.6.0"
|
||||
bytes = "1.7.1"
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ pub fn generate_peer_id(fingerprint: &[u8]) -> Id20 {
|
|||
let mut peer_id = [0u8; 20];
|
||||
|
||||
peer_id[..8].copy_from_slice(fingerprint);
|
||||
rand::thread_rng().fill_bytes(&mut peer_id[8..]);
|
||||
rand::rng().fill_bytes(&mut peer_id[8..]);
|
||||
|
||||
Id20::new(peer_id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ upnp-serve = { path = "../upnp-serve", default-features = false, version = "1",
|
|||
libc = "0.2.158"
|
||||
signal-hook = "0.3.17"
|
||||
tokio-util = "0.7.11"
|
||||
gethostname = "0.5.0"
|
||||
gethostname = "1"
|
||||
url = "2"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ librqbit-core = { path = "../librqbit_core", default-features = false, version =
|
|||
byteorder = "1.5"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
urlencoding = "2"
|
||||
rand = "0.8"
|
||||
rand = "0.9"
|
||||
tracing = "0.1.40"
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json"] }
|
||||
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3" }
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const CONNECTION_ID_MAGIC: ConnectionId = 0x41727101980;
|
|||
pub type TransactionId = u32;
|
||||
|
||||
pub fn new_transaction_id() -> TransactionId {
|
||||
rand::thread_rng().gen()
|
||||
rand::rng().random()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ sha1-ring = ["librqbit-sha1-wrapper/sha1-ring", "librqbit-core/sha1-ring"]
|
|||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
axum = { version = "0.8", features = ["tokio"] }
|
||||
tokio = { version = "1.39.3", features = ["full"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tracing = "0.1.40"
|
||||
bstr = "1.10.0"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
|
@ -27,7 +27,7 @@ http = "1.1.0"
|
|||
httparse = "1.9.4"
|
||||
uuid = { version = "1.10.0", features = ["v4"] }
|
||||
librqbit-upnp = { version = "1", path = "../upnp", default-features = false }
|
||||
gethostname = "0.5.0"
|
||||
gethostname = "1"
|
||||
librqbit-sha1-wrapper = { path = "../sha1w", version = "4", default-features = false }
|
||||
librqbit-core = { version = "5", path = "../librqbit_core", default-features = false }
|
||||
mime_guess = "2.0.5"
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ impl SubscribeRequest {
|
|||
}
|
||||
|
||||
impl SubscribeRequest {
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub fn parse(
|
||||
request: axum::extract::Request,
|
||||
) -> Result<SubscribeRequest, axum::response::Response> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue