Fix root crate compilation dependencies to force sha1*
This commit is contained in:
parent
9eed5aeb07
commit
0214817122
7 changed files with 47 additions and 3 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
|
@ -120,6 +120,15 @@ version = "1.0.86"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "assert_cfg"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04e2651f366b7ee3f97729fded1441539b49d5f39eeb05b842689e11e84501b2"
|
||||||
|
dependencies = [
|
||||||
|
"const_panic",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-backtrace"
|
name = "async-backtrace"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
|
|
@ -531,6 +540,12 @@ version = "0.9.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const_panic"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7782af8f90fe69a4bb41e460abe1727d493403d8b2cc43201a3a3e906b24379f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
|
@ -1517,6 +1532,7 @@ name = "librqbit-core"
|
||||||
version = "4.0.1"
|
version = "4.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"assert_cfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
"directories",
|
"directories",
|
||||||
|
|
@ -1583,6 +1599,7 @@ dependencies = [
|
||||||
name = "librqbit-sha1-wrapper"
|
name = "librqbit-sha1-wrapper"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"assert_cfg",
|
||||||
"crypto-hash",
|
"crypto-hash",
|
||||||
"ring",
|
"ring",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,19 @@ http-api = ["axum", "tower-http"]
|
||||||
upnp-serve-adapter = ["upnp-serve"]
|
upnp-serve-adapter = ["upnp-serve"]
|
||||||
webui = []
|
webui = []
|
||||||
timed_existence = []
|
timed_existence = []
|
||||||
default-tls = ["reqwest/default-tls", "sha1w/sha1-crypto-hash"]
|
default-tls = [
|
||||||
rust-tls = ["reqwest/rustls-tls", "sha1w/sha1-ring"]
|
"reqwest/default-tls",
|
||||||
|
"sha1w/sha1-crypto-hash",
|
||||||
|
"bencode/sha1-crypto-hash",
|
||||||
|
"librqbit-core/sha1-crypto-hash",
|
||||||
|
]
|
||||||
|
rust-tls = [
|
||||||
|
"reqwest/rustls-tls",
|
||||||
|
"sha1w/sha1-ring",
|
||||||
|
"sha1w/sha1-ring",
|
||||||
|
"bencode/sha1-ring",
|
||||||
|
"librqbit-core/sha1-ring",
|
||||||
|
]
|
||||||
storage_middleware = ["lru"]
|
storage_middleware = ["lru"]
|
||||||
storage_examples = []
|
storage_examples = []
|
||||||
tracing-subscriber-utils = ["tracing-subscriber"]
|
tracing-subscriber-utils = ["tracing-subscriber"]
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ directories = "5"
|
||||||
tokio-util = "0.7.10"
|
tokio-util = "0.7.10"
|
||||||
data-encoding = "2.6.0"
|
data-encoding = "2.6.0"
|
||||||
bytes = "1.7.1"
|
bytes = "1.7.1"
|
||||||
|
assert_cfg = "0.1.0"
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,8 @@ pub mod speed_estimator;
|
||||||
pub mod torrent_metainfo;
|
pub mod torrent_metainfo;
|
||||||
|
|
||||||
pub use hash_id::Id20;
|
pub use hash_id::Id20;
|
||||||
|
|
||||||
|
assert_cfg::exactly_one! {
|
||||||
|
feature = "sha1-crypto-hash",
|
||||||
|
feature = "sha1-ring",
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,11 @@ pub fn torrent_from_bytes_ext<'de, BufType: Deserialize<'de> + From<&'de [u8]>>(
|
||||||
let mut t = TorrentMetaV1::deserialize(&mut de)?;
|
let mut t = TorrentMetaV1::deserialize(&mut de)?;
|
||||||
let (digest, info_bytes) = match (de.torrent_info_digest, de.torrent_info_bytes) {
|
let (digest, info_bytes) = match (de.torrent_info_digest, de.torrent_info_bytes) {
|
||||||
(Some(digest), Some(info_bytes)) => (digest, info_bytes),
|
(Some(digest), Some(info_bytes)) => (digest, info_bytes),
|
||||||
_ => anyhow::bail!("programming error"),
|
(o1, o2) => anyhow::bail!(
|
||||||
|
"programming error: digest.is_some()={}, info_bytes.is_some()={}. Probably one of bencode/sha1* features isn't enabled.",
|
||||||
|
o1.is_some(),
|
||||||
|
o2.is_some()
|
||||||
|
),
|
||||||
};
|
};
|
||||||
t.info_hash = Id20::new(digest);
|
t.info_hash = Id20::new(digest);
|
||||||
Ok(ParsedTorrent {
|
Ok(ParsedTorrent {
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,6 @@ sha1-crypto-hash = ["crypto-hash"]
|
||||||
sha1-ring = ["ring"]
|
sha1-ring = ["ring"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
assert_cfg = "0.1.0"
|
||||||
crypto-hash = { version = "0.3", optional = true }
|
crypto-hash = { version = "0.3", optional = true }
|
||||||
ring = { version = "0.17", optional = true }
|
ring = { version = "0.17", optional = true }
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ pub trait ISha1 {
|
||||||
fn finish(self) -> [u8; 20];
|
fn finish(self) -> [u8; 20];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_cfg::exactly_one! {
|
||||||
|
feature = "sha1-crypto-hash",
|
||||||
|
feature = "sha1-ring",
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "sha1-crypto-hash")]
|
#[cfg(feature = "sha1-crypto-hash")]
|
||||||
mod crypto_hash_impl {
|
mod crypto_hash_impl {
|
||||||
use super::ISha1;
|
use super::ISha1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue