Bump version to 4.7.0

This commit is contained in:
Orne Brocaar 2024-03-13 10:00:37 +00:00
parent c815c6be88
commit 8c875c3bf1
43 changed files with 75 additions and 93 deletions

10
Cargo.lock generated
View File

@ -570,7 +570,7 @@ dependencies = [
[[package]]
name = "backend"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"aes-kw",
"anyhow",
@ -787,7 +787,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"aes",
"anyhow",
@ -874,7 +874,7 @@ dependencies = [
[[package]]
name = "chirpstack_api"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"diesel",
"hex",
@ -2434,7 +2434,7 @@ dependencies = [
[[package]]
name = "lrwn"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"aes",
"anyhow",
@ -2448,7 +2448,7 @@ dependencies = [
[[package]]
name = "lrwn_filters"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"hex",
"lrwn",

View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api-grpc-web",
"version": "4.7.0-test.4",
"version": "4.7.0",
"description": "Chirpstack gRPC-web API",
"license": "MIT",
"devDependencies": {

View File

@ -8,7 +8,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.7.0-test.4"
version = "4.7.0"
repositories {
mavenCentral()

2
api/js/package.json vendored
View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api",
"version": "4.7.0-test.4",
"version": "4.7.0",
"description": "Chirpstack JS and TS API",
"license": "MIT",
"devDependencies": {

View File

@ -9,7 +9,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.7.0-test.4"
version = "4.7.0"
repositories {
mavenCentral()

View File

@ -18,7 +18,7 @@ CLASSIFIERS = [
setup(
name='chirpstack-api',
version = "4.7.0-test.4",
version = "4.7.0",
url='https://github.com/brocaar/chirpstack-api',
author='Orne Brocaar',
author_email='info@brocaar.com',

2
api/rust/Cargo.lock generated vendored
View File

@ -178,7 +178,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack_api"
version = "4.7.0-test.4"
version = "4.7.0"
dependencies = [
"diesel",
"hex",

2
api/rust/Cargo.toml vendored
View File

@ -1,7 +1,7 @@
[package]
name = "chirpstack_api"
description = "ChirpStack Protobuf / gRPC API definitions."
version = "4.7.0-test.4"
version = "4.7.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
license = "MIT"
homepage = "https://www.chirpstack.io"

View File

@ -2,13 +2,12 @@ include!(concat!(env!("OUT_DIR"), "/internal/internal.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/internal/internal.serde.rs"));
#[cfg(feature = "diesel")]
use std::io::Cursor;
#[cfg(feature = "diesel")]
use diesel::{backend::Backend, deserialize, serialize, sql_types::Binary};
#[cfg(feature = "diesel")]
use prost::Message;
#[cfg(feature = "diesel")]
use std::io::Cursor;
impl DeviceSession {
pub fn get_a_f_cnt_down(&self) -> u32 {
@ -49,10 +48,10 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for DeviceSession
where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result {
fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.encode_to_vec(),
&mut out.reborrow(),
)
}
}
}

View File

@ -1,6 +1,6 @@
[package]
name = "backend"
version = "4.7.0-test.4"
version = "4.7.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
publish = false

View File

@ -423,8 +423,9 @@ impl Client {
}
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
pub enum MessageType {
#[default]
JoinReq,
JoinAns,
RejoinReq,
@ -441,14 +442,9 @@ pub enum MessageType {
XmitDataAns,
}
impl Default for MessageType {
fn default() -> Self {
MessageType::JoinReq
}
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
pub enum ResultCode {
#[default]
Success,
MICFailed,
JoinReqFailed,
@ -471,12 +467,6 @@ pub enum ResultCode {
Other,
}
impl Default for ResultCode {
fn default() -> Self {
ResultCode::Success
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
pub enum RatePolicy {
Drop,

View File

@ -3,7 +3,7 @@ name = "chirpstack"
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
repository = "https://github.com/chirpstack/chirpstack"
homepage = "https://www.chirpstack.io/"
version = "4.7.0-test.4"
version = "4.7.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
publish = false

View File

@ -1736,7 +1736,7 @@ impl ApplicationService for Application {
application::IftttConfiguration {
key: req_int.key.clone(),
uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(),
req_int.uplink_values.first().cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(),
],
arbitrary_json: req_int.arbitrary_json,
@ -1820,7 +1820,7 @@ impl ApplicationService for Application {
application::IftttConfiguration {
key: req_int.key.clone(),
uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(),
req_int.uplink_values.first().cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(),
],
arbitrary_json: req_int.arbitrary_json,

View File

@ -104,7 +104,7 @@ pub async fn _handle_request(bp: BasePayload, b: Vec<u8>) -> http::Response<hype
}
};
match joinserver::get(sender_id) {
match joinserver::get(sender_id).await {
Ok(v) => v,
Err(_) => {
warn!("Unknown SenderID");

View File

@ -1,6 +1,7 @@
use std::sync::{Arc, RwLock};
use std::sync::Arc;
use anyhow::Result;
use tokio::sync::RwLock;
use tracing::info;
use crate::{config, stream};
@ -15,7 +16,7 @@ pub async fn setup() -> Result<()> {
info!("Setting up Join Server clients");
let conf = config::get();
let mut clients_w = CLIENTS.write().unwrap();
let mut clients_w = CLIENTS.write().await;
*clients_w = vec![];
for js in &conf.join_server.servers {
@ -38,8 +39,8 @@ pub async fn setup() -> Result<()> {
Ok(())
}
pub fn get(join_eui: EUI64) -> Result<Arc<Client>> {
let clients_r = CLIENTS.read().unwrap();
pub async fn get(join_eui: EUI64) -> Result<Arc<Client>> {
let clients_r = CLIENTS.read().await;
for client in clients_r.iter() {
if client.0.matches(join_eui) {
return Ok(client.1.clone());
@ -53,7 +54,7 @@ pub fn get(join_eui: EUI64) -> Result<Arc<Client>> {
}
#[cfg(test)]
pub fn reset() {
let mut clients_w = CLIENTS.write().unwrap();
pub async fn reset() {
let mut clients_w = CLIENTS.write().await;
*clients_w = vec![];
}

View File

@ -51,7 +51,7 @@ async fn get_ca_cert(ca_cert_file: &str, ca_key_file: &str) -> Result<Certificat
let params = CertificateParams::from_ca_cert_pem(&ca_cert_s, ca_key)
.context("Parse gateway CA certificate")?;
Ok(Certificate::from_params(params).context("Init Certificate struct")?)
Certificate::from_params(params).context("Init Certificate struct")
}
// This returns the CA, certificate and private-key as PEM encoded strings.

View File

@ -623,7 +623,7 @@ impl Data {
let ds = self.device.get_device_session()?;
self.mac_commands = filter_mac_commands(&ds, &self.mac_commands);
self.mac_commands = filter_mac_commands(ds, &self.mac_commands);
Ok(())
}

View File

@ -38,8 +38,7 @@ pub async fn get_geoloc_buffer(
let rx_info: Vec<gw::UplinkRxInfo> = uplink
.rx_info
.iter()
.cloned()
.filter(|rx_info| {
.filter(|&rx_info| {
let ts: DateTime<Utc> = match &rx_info.gw_time {
None => {
return false;
@ -55,6 +54,7 @@ pub async fn get_geoloc_buffer(
// The interval between now and then must be smaller than the TTL
(ts - Utc::now()) < ttl
})
.cloned()
.collect();
if rx_info.len() > 3 {

View File

@ -134,7 +134,7 @@ impl<'a> Integration<'a> {
command: r"(?P<command>[\w]+)".to_string(),
},
)?)?,
qos: qos,
qos,
json: conf.json,
client,
templates,

View File

@ -119,7 +119,7 @@ pub async fn save(name: &str, record: &Record) -> Result<()> {
.unwrap(),
};
let key = get_key(&name, a, ts);
let key = get_key(name, a, ts);
for (k, v) in &record.metrics {
// Passing a reference to hincr will return a runtime error.

View File

@ -119,7 +119,7 @@ pub async fn get_by_email_and_pw(email: &str, pw: &str) -> Result<User, Error> {
}
};
if verify_password(&pw, &u.password_hash) {
if verify_password(pw, &u.password_hash) {
return Ok(u);
}

View File

@ -112,7 +112,7 @@ async fn handle_stream(
k: &str,
v: &redis::Value,
) -> Result<()> {
match k.as_ref() {
match k {
"up" => {
trace!(key = %k, id = %stream_id, "Event-log received from stream");
if let redis::Value::Data(b) = v {

View File

@ -276,7 +276,7 @@ async fn handle_stream(
k: &str,
v: &redis::Value,
) -> Result<()> {
match k.as_ref() {
match k {
"up" => {
trace!(key = %k, id = %stream_id, "Frame-log received from stream");
if let redis::Value::Data(b) = v {

View File

@ -167,7 +167,7 @@ async fn test_fns_uplink() {
sns_pr_start_req_mock.assert();
sns_pr_start_req_mock.delete();
joinserver::reset();
joinserver::reset().await;
}
#[tokio::test]

View File

@ -246,7 +246,7 @@ async fn test_fns() {
})()
.await;
joinserver::reset();
joinserver::reset().await;
}
#[tokio::test]
@ -430,7 +430,7 @@ async fn test_sns() {
pr_start_ans
);
joinserver::reset();
joinserver::reset().await;
}
#[tokio::test]
@ -588,5 +588,5 @@ async fn test_sns_roaming_not_allowed() {
pr_start_ans
);
joinserver::reset();
joinserver::reset().await;
}

View File

@ -215,7 +215,7 @@ impl Data {
let mac = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl
} else {
return Err(Error::AnyhowError(anyhow!("Expected MacPayload")));
return Err(Error::Anyhow(anyhow!("Expected MacPayload")));
};
if roaming::is_roaming_dev_addr(mac.fhdr.devaddr) {
@ -234,7 +234,7 @@ impl Data {
let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl.fhdr.devaddr
} else {
return Err(Error::AnyhowError(anyhow!("No MacPayload in PhyPayload")));
return Err(Error::Anyhow(anyhow!("No MacPayload in PhyPayload")));
};
match device::get_for_phypayload_and_incr_f_cnt_up(
@ -277,7 +277,7 @@ impl Data {
return Err(Error::Abort);
}
_ => {
return Err(Error::AnyhowError(
return Err(Error::Anyhow(
anyhow::Error::new(e).context("Get device-session"),
));
}
@ -295,7 +295,7 @@ impl Data {
let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl.fhdr.devaddr
} else {
return Err(Error::AnyhowError(anyhow!("No MacPayload in PhyPayload")));
return Err(Error::Anyhow(anyhow!("No MacPayload in PhyPayload")));
};
let dr = relay_ctx.req.metadata.dr;
@ -334,7 +334,7 @@ impl Data {
return Err(Error::Abort);
}
_ => {
return Err(Error::AnyhowError(
return Err(Error::Anyhow(
anyhow::Error::new(e).context("Get device-session"),
));
}

View File

@ -9,5 +9,5 @@ pub enum Error {
RoamingIsNotAllowed,
#[error(transparent)]
AnyhowError(#[from] anyhow::Error),
Anyhow(#[from] anyhow::Error),
}

View File

@ -136,8 +136,8 @@ pub fn get_time_since_gps_epoch_chrono(rx_info: &[gw::UplinkRxInfo]) -> Option<c
pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Location> {
let mut with_loc: Vec<gw::UplinkRxInfo> = rx_info
.iter()
.filter(|&i| i.location.is_some())
.cloned()
.filter(|i| i.location.is_some())
.collect();
with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap());
with_loc

View File

@ -258,7 +258,7 @@ impl JoinRequest {
if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(jr.join_eui)?);
self.js_client = Some(joinserver::get(jr.join_eui).await?);
}
Ok(())

View File

@ -58,7 +58,7 @@ impl JoinRequest {
trace!("Getting home netid");
trace!(join_eui = %self.join_request.join_eui, "Trying to get join-server client");
let js_client = joinserver::get(self.join_request.join_eui)?;
let js_client = joinserver::get(self.join_request.join_eui).await?;
let mut home_ns_req = backend::HomeNSReqPayload {
dev_eui: self.join_request.dev_eui.to_vec(),

View File

@ -162,7 +162,7 @@ impl JoinRequest {
if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(jr.join_eui)?);
self.js_client = Some(joinserver::get(jr.join_eui).await?);
}
Ok(())

View File

@ -248,7 +248,7 @@ async fn deduplicate_put(
async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> {
let items_b: Vec<Vec<u8>> = {
redis::cmd("SMEMBERS")
.arg(&key)
.arg(key)
.query_async(&mut get_async_redis_conn().await?)
.await
.context("Deduplication collect")?
@ -285,7 +285,7 @@ async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> {
pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -> Result<()> {
let rx_info = &uplink
.rx_info
.get(0)
.first()
.context("Unable to get first item from rx_info")?;
let region_config_id = rx_info

View File

@ -3,7 +3,7 @@ name = "lrwn_filters"
description = "Library for filtering LoRaWAN payloads on DevAddr and JoinEUIs prefixes"
homepage = "https://www.chirpstack.io/"
license = "MIT"
version = "4.7.0-test.4"
version = "4.7.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
repository = "https://github.com/chirpstack/chirpstack"

View File

@ -3,7 +3,7 @@ name = "lrwn"
description = "Library for encoding / decoding LoRaWAN frames."
homepage = "https://www.chirpstack.io"
license = "MIT"
version = "4.7.0-test.4"
version = "4.7.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
repository = "https://github.com/chirpstack/chirpstack"

View File

@ -130,7 +130,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for AES128Key
where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result {
fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_bytes(),
&mut out.reborrow(),

View File

@ -273,7 +273,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for DevAddr
where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result {
fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_be_bytes(),
&mut out.reborrow(),

View File

@ -138,7 +138,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for EUI64
where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result {
fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_be_bytes(),
&mut out.reborrow(),
@ -197,7 +197,7 @@ impl FromStr for EUI64Prefix {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.to_string();
let mut size: u64 = 64;
let parts: Vec<&str> = s.split("/").collect();
let parts: Vec<&str> = s.split('/').collect();
if parts.len() == 2 {
size = parts[1].parse().map_err(|_| Error::EUI64PrefixFormat)?;
}

View File

@ -1891,7 +1891,7 @@ impl serialize::ToSql<SmallInt, diesel::pg::Pg> for RelayModeActivation
where
i16: serialize::ToSql<SmallInt, diesel::pg::Pg>,
{
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result {
fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
let i = self.to_u8() as i16;
<i16 as serialize::ToSql<SmallInt, diesel::pg::Pg>>::to_sql(&i, &mut out.reborrow())
}
@ -2191,7 +2191,7 @@ impl PayloadCodec for UpdateUplinkListReqPayload {
let mut b = [0; 26];
cur.read_exact(&mut b)?;
return Ok(UpdateUplinkListReqPayload {
Ok(UpdateUplinkListReqPayload {
uplink_list_idx: b[0] & 0x0f,
uplink_limit: UplinkLimitPL::from_u8(b[1]),
dev_addr: crate::DevAddr::from_le_bytes({
@ -2209,7 +2209,7 @@ impl PayloadCodec for UpdateUplinkListReqPayload {
bb.copy_from_slice(&b[10..26]);
bb
}),
});
})
}
fn encode(&self) -> Result<Vec<u8>> {
@ -2432,7 +2432,7 @@ impl PowerLevel {
pub fn from_bytes(b: [u8; 2]) -> Self {
PowerLevel {
wor_snr: (b[0] & 0x1f) as isize - 20,
wor_rssi: -1 * ((b[0] >> 5) | ((b[1] & 0x0f) << 3)) as isize - 15,
wor_rssi: -(((b[0] >> 5) | ((b[1] & 0x0f) << 3)) as isize) - 15,
}
}
@ -2456,7 +2456,7 @@ impl PowerLevel {
// Encode values
let wor_snr = (wor_snr + 20) as u8;
let wor_rssi = ((wor_rssi as isize + 15) * -1) as u8;
let wor_rssi = -(wor_rssi + 15) as u8;
[wor_snr | wor_rssi << 5, wor_rssi >> 3]
}

View File

@ -54,7 +54,7 @@ impl NetID {
match self.netid_type() {
0 | 1 => self.get_id(6),
2 => self.get_id(9),
3 | 4 | 5 | 6 | 7 => self.get_id(21),
3..=7 => self.get_id(21),
_ => vec![],
}
}

View File

@ -1176,11 +1176,7 @@ impl Region for Configuration {
for pl in pls {
if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 {
for cm in ch_mask.iter_mut().take(64) {
if pl.redundancy.ch_mask_cntl == 6 {
*cm = true;
} else {
*cm = false;
}
*cm = pl.redundancy.ch_mask_cntl == 6;
}
for (i, cm) in pl.ch_mask.into_iter().enumerate() {

View File

@ -864,11 +864,7 @@ impl Region for Configuration {
for pl in pls {
if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 {
for cm in ch_mask.iter_mut().take(64) {
if pl.redundancy.ch_mask_cntl == 6 {
*cm = true;
} else {
*cm = false;
}
*cm = pl.redundancy.ch_mask_cntl == 6;
}
for (i, cm) in pl.ch_mask.into_iter().enumerate() {

View File

@ -19,7 +19,7 @@ impl UplinkMetadata {
UplinkMetadata {
dr: b[0] & 0x0f,
snr: ((b[0] >> 4) | ((b[1] & 0x01) << 4)) as isize - 20,
rssi: -1 * (b[1] >> 1) as isize - 15,
rssi: -((b[1] >> 1) as isize) - 15,
wor_channel: b[2] & 0x03,
}
}
@ -52,7 +52,7 @@ impl UplinkMetadata {
// Encode values
let snr = (snr + 20) as u8;
let rssi = ((rssi as isize + 15) * -1) as u8;
let rssi = -(rssi + 15) as u8;
Ok([self.dr | snr << 4, snr >> 4 | rssi << 1, self.wor_channel])
}
@ -97,7 +97,7 @@ pub struct ForwardDownlinkReq {
impl ForwardDownlinkReq {
pub fn from_slice(b: &[u8]) -> Result<Self> {
Ok(ForwardDownlinkReq {
payload: Box::new(PhyPayload::from_slice(&b)?),
payload: Box::new(PhyPayload::from_slice(b)?),
})
}

View File

@ -1,6 +1,6 @@
{
"name": "chirpstack-ui",
"version": "4.7.0-test.4",
"version": "4.7.0",
"private": true,
"dependencies": {
"@ant-design/colors": "^7.0.0",