Update dependencies.

This commit is contained in:
Orne Brocaar 2025-03-20 10:34:39 +00:00
parent f97af991be
commit 7c134a549d
19 changed files with 947 additions and 620 deletions

1470
Cargo.lock generated

File diff suppressed because it is too large Load Diff

5
api/rust/Cargo.toml vendored
View File

@ -18,13 +18,12 @@
prost = "0.13" prost = "0.13"
prost-types = "0.13" prost-types = "0.13"
hex = "0.4" hex = "0.4"
rand = "0.8" rand = "0.9"
tonic = { version = "0.12", features = [ tonic = { version = "0.12", features = [
"codegen", "codegen",
"prost", "prost",
], default-features = false, optional = true } ], default-features = false, optional = true }
tokio = { version = "1.41", features = ["macros"], optional = true } tokio = { version = "1.44", features = ["macros"], optional = true }
pbjson = { version = "0.7", optional = true } pbjson = { version = "0.7", optional = true }
pbjson-types = { version = "0.7", optional = true } pbjson-types = { version = "0.7", optional = true }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }

4
api/rust/src/gw.rs vendored
View File

@ -115,11 +115,11 @@ impl UplinkFrame {
if let Some(rx_info) = &self.rx_info_legacy { if let Some(rx_info) = &self.rx_info_legacy {
if self.rx_info.is_none() { if self.rx_info.is_none() {
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
self.rx_info = Some(UplinkRxInfo { self.rx_info = Some(UplinkRxInfo {
gateway_id: hex::encode(&rx_info.gateway_id), gateway_id: hex::encode(&rx_info.gateway_id),
uplink_id: rng.gen::<u32>(), uplink_id: rng.random::<u32>(),
gw_time: rx_info.time, gw_time: rx_info.time,
ns_time: None, ns_time: None,
time_since_gps_epoch: rx_info.time_since_gps_epoch, time_since_gps_epoch: rx_info.time_since_gps_epoch,

View File

@ -12,14 +12,14 @@
anyhow = "1.0" anyhow = "1.0"
tracing = "0.1" tracing = "0.1"
hex = "0.4" hex = "0.4"
rand = "0.8" rand = "0.9"
aes-kw = "0.2" aes-kw = "0.2"
reqwest = { version = "0.12", features = [ reqwest = { version = "0.12", features = [
"json", "json",
"rustls-tls", "rustls-tls",
], default-features = false } ], default-features = false }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
tokio = { version = "1.42", features = ["macros"] } tokio = { version = "1.44", features = ["macros"] }
chirpstack_api = { path = "../api/rust", default-features = false, features = [ chirpstack_api = { path = "../api/rust", default-features = false, features = [
"json", "json",
] } ] }

View File

@ -10,7 +10,7 @@
[dependencies] [dependencies]
chirpstack_api = { path = "../api/rust", version = "4.12.0-test.1" } chirpstack_api = { path = "../api/rust", version = "4.12.0-test.1" }
redis = { version = "0.27", features = [ redis = { version = "0.29", features = [
"cluster-async", "cluster-async",
"tokio-rustls-comp", "tokio-rustls-comp",
] } ] }
@ -23,7 +23,7 @@
], default-features = true } ], default-features = true }
async-trait = "0.1" async-trait = "0.1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.42", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.44", features = ["macros", "rt-multi-thread"] }
lazy_static = "1.5" lazy_static = "1.5"
serde_json = "1.0" serde_json = "1.0"
toml = "0.8" toml = "0.8"

View File

@ -20,7 +20,7 @@
serde_urlencoded = "0.7" serde_urlencoded = "0.7"
humantime-serde = "1.1" humantime-serde = "1.1"
toml = "0.8" toml = "0.8"
handlebars = "6.2" handlebars = "6.3"
validator = { version = "0.20", features = ["derive"] } validator = { version = "0.20", features = ["derive"] }
# Database # Database
@ -34,8 +34,8 @@
tokio-postgres = { version = "0.7", optional = true } tokio-postgres = { version = "0.7", optional = true }
tokio-postgres-rustls = { version = "0.13", optional = true } tokio-postgres-rustls = { version = "0.13", optional = true }
bigdecimal = "0.4" bigdecimal = "0.4"
redis = { version = "0.27", features = ["tls-rustls", "tokio-rustls-comp"] } redis = { version = "0.29", features = ["tls-rustls", "tokio-rustls-comp"] }
deadpool-redis = { version = "0.18", features = ["cluster", "serde"] } deadpool-redis = { version = "0.20", features = ["cluster", "serde"] }
# Logging # Logging
tracing = "0.1" tracing = "0.1"
@ -81,21 +81,21 @@
tonic = "0.12" tonic = "0.12"
tonic-web = "0.12" tonic-web = "0.12"
tonic-reflection = "0.12" tonic-reflection = "0.12"
tokio = { version = "1.42", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.44", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1" tokio-stream = "0.1"
prost-types = "0.13" prost-types = "0.13"
prost = "0.13" prost = "0.13"
pbjson-types = "0.7" pbjson-types = "0.7"
# gRPC and HTTP multiplexing # gRPC and HTTP multiplexing
axum = "0.7" axum = "0.8"
axum-server = { version = "0.7.1", features = ["tls-rustls-no-provider"] } axum-server = { version = "0.7", features = ["tls-rustls-no-provider"] }
tower = { version = "0.5", features = ["util"] } tower = { version = "0.5", features = ["util"] }
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
http = "1.1" http = "1.3"
http-body = "1.0" http-body = "1.0"
rust-embed = "8.5" rust-embed = "8.6"
mime_guess = "2.0" mime_guess = "2.0"
tower-http = { version = "0.6", features = ["trace", "auth"] } tower-http = { version = "0.6", features = ["trace", "auth"] }
@ -105,7 +105,7 @@
# Authentication # Authentication
pbkdf2 = { version = "0.12", features = ["simple"] } pbkdf2 = { version = "0.12", features = ["simple"] }
rand_core = { version = "0.6", features = ["std"] } rand_core = { version = "0.6.4", features = ["std"] }
jsonwebtoken = "9.3" jsonwebtoken = "9.3"
rustls = { version = "0.23", default-features = false, features = [ rustls = { version = "0.23", default-features = false, features = [
"logging", "logging",
@ -116,12 +116,12 @@
rustls-native-certs = "0.8" rustls-native-certs = "0.8"
rustls-pemfile = "2.2" rustls-pemfile = "2.2"
pem = "3.0" pem = "3.0"
x509-parser = "0.16" x509-parser = "0.17"
rsa = "0.9" rsa = "0.9"
sec1 = { version = "0.7.3", features = ["alloc", "pem", "pkcs8"] } sec1 = { version = "0.7.3", features = ["alloc", "pem", "pkcs8"] }
rcgen = { version = "0.13.1", features = ["x509-parser"] } rcgen = { version = "0.13.1", features = ["x509-parser"] }
oauth2 = "5.0.0-alpha.4" oauth2 = "5.0.0"
openidconnect = { version = "4.0.0-alpha.2", features = [ openidconnect = { version = "4.0.0", features = [
"accept-rfc3339-timestamps", "accept-rfc3339-timestamps",
] } ] }
@ -130,7 +130,7 @@
hex = "0.4" hex = "0.4"
# Codecs # Codecs
rquickjs = { version = "0.8", features = [ rquickjs = { version = "0.9", features = [
"bindgen", "bindgen",
"loader", "loader",
"array-buffer", "array-buffer",
@ -139,15 +139,15 @@
# Misc # Misc
lazy_static = "1.5" lazy_static = "1.5"
uuid = { version = "1.11", features = ["v4", "serde"] } uuid = { version = "1.16", features = ["v4", "serde"] }
chrono = "0.4" chrono = "0.4"
async-trait = "0.1" async-trait = "0.1"
aes = "0.8" aes = "0.8"
rand = "0.8" rand = "0.9"
base64 = "0.22" base64 = "0.22"
async-recursion = "1.1" async-recursion = "1.1"
regex = "1.11" regex = "1.11"
petgraph = "0.6" petgraph = "0.7"
prometheus-client = "0.22" prometheus-client = "0.22"
pin-project = "1.1" pin-project = "1.1"
scoped-futures = { version = "0.1", features = ["std"] } scoped-futures = { version = "0.1", features = ["std"] }
@ -157,7 +157,7 @@
# Development and testing # Development and testing
[dev-dependencies] [dev-dependencies]
httpmock = "0.7.0" httpmock = "0.7.0"
bytes = "1.8" bytes = "1.10"
dotenv = "0.15" dotenv = "0.15"
[features] [features]

View File

@ -47,12 +47,12 @@ dist:
test: test:
cargo fmt --check cargo fmt --check
cargo clippy --no-deps --no-default-features --features="$(DATABASE)" cargo clippy --no-deps --no-default-features --features="$(DATABASE)"
TZ=UTC cargo test --no-default-features --features="$(DATABASE)" RUST_MIN_STACK=8388608 TZ=UTC cargo test --no-default-features --features="$(DATABASE)"
test-all: test-all:
cargo fmt --check cargo fmt --check
cargo clippy --no-deps --no-default-features --features="$(DATABASE)" cargo clippy --no-deps --no-default-features --features="$(DATABASE)"
TZ=UTC cargo test --no-default-features --features="$(DATABASE),test-all-integrations" RUST_MIN_STACK=8388608 TZ=UTC cargo test --no-default-features --features="$(DATABASE),test-all-integrations"
migration-generate: migration-generate:
ifeq ($(NAME),) ifeq ($(NAME),)

View File

@ -1,6 +1,6 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use rand::seq::SliceRandom; use rand::seq::IndexedRandom;
use super::{Handler, Request, Response}; use super::{Handler, Request, Response};
use crate::region; use crate::region;
@ -134,7 +134,7 @@ impl Handler for Algorithm {
// In case there are multiple with the same coding-rate, we take // In case there are multiple with the same coding-rate, we take
// a random one. // a random one.
resp.dr = drs resp.dr = drs
.choose(&mut rand::thread_rng()) .choose(&mut rand::rng())
.cloned() .cloned()
.ok_or_else(|| anyhow!("Random returned None"))?; .ok_or_else(|| anyhow!("Random returned None"))?;
resp.nb_trans = 1; // 1 is the recommeded value resp.nb_trans = 1; // 1 is the recommeded value

View File

@ -3,7 +3,7 @@ use rand::RngCore;
use lrwn::AES128Key; use lrwn::AES128Key;
pub fn get_random_aes_key() -> AES128Key { pub fn get_random_aes_key() -> AES128Key {
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
let mut key: [u8; 16] = [0; 16]; let mut key: [u8; 16] = [0; 16];
rng.fill_bytes(&mut key); rng.fill_bytes(&mut key);
AES128Key::from_bytes(key) AES128Key::from_bytes(key)

View File

@ -227,7 +227,7 @@ pub mod test {
let out = decode(Utc::now(), 10, &vars, &decoder, &[0x01, 0x02, 0x03]).await; let out = decode(Utc::now(), 10, &vars, &decoder, &[0x01, 0x02, 0x03]).await;
assert_eq!( assert_eq!(
"JS error: Error: foo is not defined\n at decodeUplink (eval_script:3:1)\n at <eval> (eval_script:8:9)\n", "JS error: Error: foo is not defined\n at decodeUplink (eval_script:3:1)\n at <eval> (eval_script:8:22)\n",
out.err().unwrap().to_string() out.err().unwrap().to_string()
); );
} }
@ -368,7 +368,7 @@ pub mod test {
}; };
let out = encode(10, &vars, &encoder, &input).await; let out = encode(10, &vars, &encoder, &input).await;
assert_eq!("JS error: Error: foo is not defined\n at encodeDownlink (eval_script:3:1)\n at <eval> (eval_script:8:9)\n", out.err().unwrap().to_string()); assert_eq!("JS error: Error: foo is not defined\n at encodeDownlink (eval_script:3:1)\n at <eval> (eval_script:8:24)\n", out.err().unwrap().to_string());
} }
#[tokio::test] #[tokio::test]

View File

@ -1,12 +1,12 @@
use rand::seq::SliceRandom;
use rand::RngCore; use rand::RngCore;
use crate::config; use crate::config;
use lrwn::DevAddr; use lrwn::DevAddr;
use rand::seq::IndexedRandom;
pub fn get_random_dev_addr() -> DevAddr { pub fn get_random_dev_addr() -> DevAddr {
let conf = config::get(); let conf = config::get();
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
// Get configured DevAddr prefixes. // Get configured DevAddr prefixes.
let prefixes = if conf.network.dev_addr_prefixes.is_empty() { let prefixes = if conf.network.dev_addr_prefixes.is_empty() {

View File

@ -65,7 +65,7 @@ impl Data {
must_ack: bool, must_ack: bool,
mac_commands: Vec<lrwn::MACCommandSet>, mac_commands: Vec<lrwn::MACCommandSet>,
) -> Result<()> { ) -> Result<()> {
let downlink_id: u32 = rand::thread_rng().gen(); let downlink_id: u32 = rand::rng().random();
let span = span!(Level::INFO, "data_down", downlink_id = downlink_id); let span = span!(Level::INFO, "data_down", downlink_id = downlink_id);
match Data::_handle_response( match Data::_handle_response(
@ -107,7 +107,7 @@ impl Data {
must_ack: bool, must_ack: bool,
mac_commands: Vec<lrwn::MACCommandSet>, mac_commands: Vec<lrwn::MACCommandSet>,
) -> Result<()> { ) -> Result<()> {
let downlink_id: u32 = rand::thread_rng().gen(); let downlink_id: u32 = rand::rng().random();
let span = span!(Level::INFO, "data_down", downlink_id = downlink_id); let span = span!(Level::INFO, "data_down", downlink_id = downlink_id);
match Data::_handle_response_relayed( match Data::_handle_response_relayed(
@ -138,7 +138,7 @@ impl Data {
} }
pub async fn handle_schedule_next_queue_item(device: device::Device) -> Result<()> { pub async fn handle_schedule_next_queue_item(device: device::Device) -> Result<()> {
let downlink_id: u32 = rand::thread_rng().gen(); let downlink_id: u32 = rand::rng().random();
let span = let span =
span!(Level::INFO, "schedule", dev_eui = %device.dev_eui, downlink_id = downlink_id); span!(Level::INFO, "schedule", dev_eui = %device.dev_eui, downlink_id = downlink_id);

View File

@ -54,7 +54,7 @@ impl Data {
xmit_data_req: pl, xmit_data_req: pl,
dl_meta_data: dl_meta, dl_meta_data: dl_meta,
downlink_frame: gw::DownlinkFrame { downlink_frame: gw::DownlinkFrame {
downlink_id: rand::thread_rng().gen(), downlink_id: rand::rng().random(),
..Default::default() ..Default::default()
}, },
}; };

View File

@ -1,7 +1,7 @@
use std::str::FromStr; use std::str::FromStr;
use anyhow::Result; use anyhow::Result;
use rand::seq::SliceRandom; use rand::seq::IndexedRandom;
use uuid::Uuid; use uuid::Uuid;
use chirpstack_api::{gw, internal}; use chirpstack_api::{gw, internal};
@ -74,7 +74,7 @@ pub fn select_downlink_gateway(
// Return a random item from the new_items slice (filtered by min_snr_margin). // Return a random item from the new_items slice (filtered by min_snr_margin).
// If new_items is empty, then choose will return None and we return the first item from // If new_items is empty, then choose will return None and we return the first item from
// rx_info.item. // rx_info.item.
Ok(match new_items.choose(&mut rand::thread_rng()) { Ok(match new_items.choose(&mut rand::rng()) {
Some(v) => v.clone(), Some(v) => v.clone(),
None => rx_info.items[0].clone(), None => rx_info.items[0].clone(),
}) })

View File

@ -37,7 +37,7 @@ impl JoinAccept<'_> {
device: &device::Device, device: &device::Device,
join_accept: &PhyPayload, join_accept: &PhyPayload,
) -> Result<()> { ) -> Result<()> {
let downlink_id: u32 = rand::thread_rng().gen(); let downlink_id: u32 = rand::rng().random();
let span = span!(Level::INFO, "join_accept", downlink_id = downlink_id); let span = span!(Level::INFO, "join_accept", downlink_id = downlink_id);
let fut = JoinAccept::_handle(downlink_id, ufs, tenant, device, join_accept); let fut = JoinAccept::_handle(downlink_id, ufs, tenant, device, join_accept);
@ -51,7 +51,7 @@ impl JoinAccept<'_> {
device: &device::Device, device: &device::Device,
join_accept: &PhyPayload, join_accept: &PhyPayload,
) -> Result<()> { ) -> Result<()> {
let downlink_id: u32 = rand::thread_rng().gen(); let downlink_id: u32 = rand::rng().random();
let span = span!( let span = span!(
Level::INFO, Level::INFO,
"join_accept_relayed", "join_accept_relayed",

View File

@ -53,7 +53,7 @@ impl Multicast {
let mut ctx = Multicast { let mut ctx = Multicast {
downlink_frame: gw::DownlinkFrame { downlink_frame: gw::DownlinkFrame {
downlink_id: rand::thread_rng().gen(), downlink_id: rand::rng().random(),
gateway_id: qi.gateway_id.to_string(), gateway_id: qi.gateway_id.to_string(),
..Default::default() ..Default::default()
}, },

View File

@ -43,7 +43,7 @@ impl PassiveRoamingDownlink {
network_conf, network_conf,
region_conf, region_conf,
downlink_frame: gw::DownlinkFrame { downlink_frame: gw::DownlinkFrame {
downlink_id: rand::thread_rng().gen(), downlink_id: rand::rng().random(),
..Default::default() ..Default::default()
}, },
downlink_gateway: None, downlink_gateway: None,

View File

@ -99,8 +99,8 @@ impl<'a> MqttBackend<'a> {
// get client id, this will generate a random client_id when no client_id has been // get client id, this will generate a random client_id when no client_id has been
// configured. // configured.
let client_id = if conf.client_id.is_empty() { let client_id = if conf.client_id.is_empty() {
let mut rnd = rand::thread_rng(); let mut rnd = rand::rng();
let client_id: u64 = rnd.gen(); let client_id: u64 = rnd.random();
format!("{:x}", client_id) format!("{:x}", client_id)
} else { } else {
conf.client_id.clone() conf.client_id.clone()

View File

@ -66,8 +66,8 @@ impl<'a> Integration<'a> {
// get client id, this will generate a random client_id when no client_id has been // get client id, this will generate a random client_id when no client_id has been
// configured. // configured.
let client_id = if conf.client_id.is_empty() { let client_id = if conf.client_id.is_empty() {
let mut rnd = rand::thread_rng(); let mut rnd = rand::rng();
let client_id: u64 = rnd.gen(); let client_id: u64 = rnd.random();
format!("{:x}", client_id) format!("{:x}", client_id)
} else { } else {
conf.client_id.clone() conf.client_id.clone()