Compare commits

...

21 Commits

Author SHA1 Message Date
2fc762d932 Bump version to 4.11.1 2025-02-10 11:41:05 +00:00
24333f8b5d Bump version to 4.11.1-test.2 2025-02-10 11:10:11 +00:00
99239a82d4 Revert from sqlite-interactive to sqlite. 2025-02-10 10:56:48 +00:00
317c1cb14d Update dev-dependencies to shell.nix. 2025-02-10 10:27:22 +00:00
2e0d034a6b Bump version to 4.11.1 2025-02-07 15:56:39 +00:00
fb59f541b1 Fix ns_time + setting of JSON flag.
These lines were accidentally removed by 922a83597f8aaed089f5c6ed610d20c5aaa91102
when removing the metadata keys as part of the region refactor.
2025-02-03 12:46:04 +00:00
f6374f00f8 Bump version to 4.11.1-test.1 2025-01-30 19:37:17 +00:00
32a9aadbae Re-use http clients within integrations.
This reduces CPU load, especially in case when HTTPS is being used
as connections will be pooled by the http client.
2025-01-30 19:17:44 +00:00
99613014ad Return LinkCheckAns with margin=0 for non-LoRa modulations. 2025-01-22 09:09:27 +00:00
8cb2d4f383 Bump version to 4.11.0 2025-01-15 12:13:04 +00:00
96b544974e Bump version to 4.11.0-test.2 2025-01-13 15:00:37 +00:00
a71113db42 Update Rust toolchain + fix Clippy feedback. 2025-01-13 12:16:15 +00:00
2e738e1f33 Bump version to 4.11.0 2025-01-10 13:44:11 +00:00
0487d6a7f0 Bump golang.org/x/net from 0.23.0 to 0.33.0 in /examples/frame_log/go (#591)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.23.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.23.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:57:09 +00:00
6864f6ef2b Bump thiserror from 2.0.6 to 2.0.10 (#592)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 2.0.6 to 2.0.10.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.6...2.0.10)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:53:56 +00:00
9c25a5d48b Bump serde_json from 1.0.134 to 1.0.135 (#593)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.134 to 1.0.135.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.134...v1.0.135)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:53:43 +00:00
de492a7e30 Bump serde from 1.0.215 to 1.0.217 (#587)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.215 to 1.0.217.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.215...v1.0.217)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:53:32 +00:00
2028ccab9a Bump nanoid from 3.3.7 to 3.3.8 in /ui (#577)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:38:26 +00:00
724dfb138c Bump serde_json from 1.0.133 to 1.0.134 (#584)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.133 to 1.0.134.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.133...v1.0.134)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:38:00 +00:00
b6763cc951 Bump rustls from 0.23.19 to 0.23.20 (#581)
Bumps [rustls](https://github.com/rustls/rustls) from 0.23.19 to 0.23.20.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.23.19...v/0.23.20)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:37:51 +00:00
df3aafd1c4 Bump tower from 0.5.1 to 0.5.2 (#580)
Bumps [tower](https://github.com/tower-rs/tower) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/tower-rs/tower/releases)
- [Commits](https://github.com/tower-rs/tower/compare/tower-0.5.1...tower-0.5.2)

---
updated-dependencies:
- dependency-name: tower
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:37:38 +00:00
51 changed files with 309 additions and 195 deletions

92
Cargo.lock generated
View File

@ -556,9 +556,9 @@ dependencies = [
"serde_json",
"serde_path_to_error",
"serde_urlencoded",
"sync_wrapper 1.0.2",
"sync_wrapper",
"tokio",
"tower 0.5.1",
"tower 0.5.2",
"tower-layer",
"tower-service",
"tracing",
@ -579,7 +579,7 @@ dependencies = [
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper 1.0.2",
"sync_wrapper",
"tower-layer",
"tower-service",
"tracing",
@ -600,7 +600,7 @@ dependencies = [
"hyper 1.5.1",
"hyper-util",
"pin-project-lite",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-pemfile",
"rustls-pki-types",
"tokio",
@ -611,7 +611,7 @@ dependencies = [
[[package]]
name = "backend"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"aes-kw",
"anyhow",
@ -623,7 +623,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"thiserror 2.0.6",
"thiserror 2.0.10",
"tokio",
"tracing",
]
@ -813,7 +813,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chirpstack"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"aes",
"anyhow",
@ -874,7 +874,7 @@ dependencies = [
"rsa",
"rumqttc",
"rust-embed",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-native-certs 0.8.1",
"rustls-pemfile",
"scoped-futures",
@ -885,7 +885,7 @@ dependencies = [
"sha2",
"signal-hook",
"signal-hook-tokio",
"thiserror 2.0.6",
"thiserror 2.0.10",
"tokio",
"tokio-executor-trait",
"tokio-postgres",
@ -896,7 +896,7 @@ dependencies = [
"tonic",
"tonic-reflection",
"tonic-web",
"tower 0.5.1",
"tower 0.5.2",
"tower-http 0.6.2",
"tracing",
"tracing-subscriber",
@ -907,7 +907,7 @@ dependencies = [
[[package]]
name = "chirpstack_api"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"hex",
"pbjson",
@ -924,7 +924,7 @@ dependencies = [
[[package]]
name = "chirpstack_integration"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"anyhow",
"async-trait",
@ -2165,7 +2165,7 @@ dependencies = [
"http 1.2.0",
"hyper 1.5.1",
"hyper-util",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-native-certs 0.8.1",
"rustls-pki-types",
"tokio",
@ -2668,7 +2668,7 @@ dependencies = [
[[package]]
name = "lrwn"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"aes",
"anyhow",
@ -2677,17 +2677,17 @@ dependencies = [
"hex",
"lazy_static",
"serde",
"thiserror 2.0.6",
"thiserror 2.0.10",
]
[[package]]
name = "lrwn_filters"
version = "4.11.0-test.1"
version = "4.11.1"
dependencies = [
"hex",
"lrwn",
"serde",
"thiserror 2.0.6",
"thiserror 2.0.10",
]
[[package]]
@ -3157,7 +3157,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
dependencies = [
"memchr",
"thiserror 2.0.6",
"thiserror 2.0.10",
"ucd-trie",
]
@ -3534,9 +3534,9 @@ dependencies = [
"quinn-proto",
"quinn-udp",
"rustc-hash 2.1.0",
"rustls 0.23.19",
"rustls 0.23.20",
"socket2 0.5.8",
"thiserror 2.0.6",
"thiserror 2.0.10",
"tokio",
"tracing",
]
@ -3552,10 +3552,10 @@ dependencies = [
"rand",
"ring",
"rustc-hash 2.1.0",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-pki-types",
"slab",
"thiserror 2.0.6",
"thiserror 2.0.10",
"tinyvec",
"tracing",
"web-time",
@ -3689,7 +3689,7 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"rand",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-native-certs 0.7.3",
"rustls-pemfile",
"rustls-pki-types",
@ -3781,14 +3781,14 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"quinn",
"rustls 0.23.19",
"rustls 0.23.20",
"rustls-native-certs 0.8.1",
"rustls-pemfile",
"rustls-pki-types",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper 1.0.2",
"sync_wrapper",
"tokio",
"tokio-rustls 0.26.1",
"tower-service",
@ -4025,9 +4025,9 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.23.19"
version = "0.23.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b"
dependencies = [
"log",
"once_cell",
@ -4195,9 +4195,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
version = "1.0.215"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
dependencies = [
"serde_derive",
]
@ -4214,9 +4214,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.215"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"proc-macro2",
"quote",
@ -4225,9 +4225,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.133"
version = "1.0.135"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
dependencies = [
"itoa",
"memchr",
@ -4556,12 +4556,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sync_wrapper"
version = "1.0.2"
@ -4626,11 +4620,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.6"
version = "2.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47"
checksum = "a3ac7f54ca534db81081ef1c1e7f6ea8a3ef428d2fc069097c079443d24124d3"
dependencies = [
"thiserror-impl 2.0.6",
"thiserror-impl 2.0.10",
]
[[package]]
@ -4646,9 +4640,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.6"
version = "2.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312"
checksum = "9e9465d30713b56a37ede7185763c3492a91be2f5fa68d958c44e41ab9248beb"
dependencies = [
"proc-macro2",
"quote",
@ -4824,7 +4818,7 @@ checksum = "27d684bad428a0f2481f42241f821db42c54e2dc81d8c00db8536c506b0a0144"
dependencies = [
"const-oid",
"ring",
"rustls 0.23.19",
"rustls 0.23.20",
"tokio",
"tokio-postgres",
"tokio-rustls 0.26.1",
@ -4862,7 +4856,7 @@ version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37"
dependencies = [
"rustls 0.23.19",
"rustls 0.23.20",
"tokio",
]
@ -5034,14 +5028,14 @@ dependencies = [
[[package]]
name = "tower"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f"
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"pin-project-lite",
"sync_wrapper 0.1.2",
"sync_wrapper",
"tokio",
"tower-layer",
"tower-service",

View File

@ -6,11 +6,10 @@ dist:
cd chirpstack && make dist
# Install dev dependencies
# TODO: test latest cargo-deb and move it to shell.nix.
dev-dependencies:
cargo install cross --version 0.2.5
cargo install diesel_cli --version 2.2.1 --no-default-features --features postgres,sqlite
cargo install cargo-deb --version 1.43.1
cargo install cargo-generate-rpm --version 0.12.1
cargo install cargo-deb --version 1.43.1 --locked
cargo install cargo-generate-rpm --version 0.12.1 --locked
# Set the versions
version:

View File

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

View File

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

2
api/js/package.json vendored
View File

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

View File

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

View File

@ -3,7 +3,7 @@
"description": "Chirpstack PHP API",
"license": "MIT",
"type": "library",
"version": "4.11.0-test.1",
"version": "4.11.1",
"require": {
"php": ">=7.0.0",
"grpc/grpc": "^v1.57.0",

View File

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

2
api/rust/Cargo.toml vendored
View File

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

5
api/rust/build.rs vendored
View File

@ -82,11 +82,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.extern_path(".google.protobuf", well_known_types_path)
.extern_path(".common", "crate::common");
#[cfg(feature = "diesel")]
{
builder = builder.message_attribute("internal.DeviceSession", "#[derive(diesel::expression::AsExpression, diesel::deserialize::FromSqlRow)] #[diesel(sql_type = diesel::sql_types::Binary)]");
}
builder.compile_protos(
&[cs_dir
.join("internal")

View File

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

View File

@ -3,13 +3,13 @@
description = "Library for building external ChirpStack integrations"
homepage = "https://www.chirpstack.io/"
license = "MIT"
version = "4.11.0-test.1"
version = "4.11.1"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
repository = "https://github.com/chirpstack/chirpstack"
[dependencies]
chirpstack_api = { path = "../api/rust", version = "4.11.0-test.1" }
chirpstack_api = { path = "../api/rust", version = "4.11.1" }
redis = { version = "0.27", features = [
"cluster-async",
"tokio-rustls-comp",

View File

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

View File

@ -21,7 +21,7 @@ impl Plugin {
let m = rquickjs::Module::declare(ctx, "script", script.clone())
.context("Declare script")?;
let (m, m_promise) = m.eval().context("Evaluate script")?;
m_promise.finish()?;
() = m_promise.finish()?;
let id_func: rquickjs::Function = m.get("id").context("Get id function")?;
let name_func: rquickjs::Function = m.get("name").context("Get name function")?;
@ -55,7 +55,7 @@ impl Handler for Plugin {
let m = rquickjs::Module::declare(ctx.clone(), "script", self.script.clone())
.context("Declare script")?;
let (m, m_promise) = m.eval().context("Evaluate script")?;
m_promise.finish()?;
() = m_promise.finish()?;
let func: rquickjs::Function = m.get("handle").context("Get handle function")?;
let device_variables = rquickjs::Object::new(ctx.clone())?;

View File

@ -601,7 +601,7 @@ async fn handle_async_ans(bp: &BasePayload, b: &[u8]) -> Result<Response> {
let key = redis_key(format!("backend:async:{}", transaction_id));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)

View File

@ -162,7 +162,7 @@ async fn store_verifier(
trace!("Storing verifier");
let key = redis_key(format!("auth:oauth2:{}", token.secret()));
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(Duration::try_minutes(5).unwrap().num_milliseconds())
.arg(verifier.secret())

View File

@ -119,7 +119,7 @@ async fn store_nonce(state: &CsrfToken, nonce: &Nonce) -> Result<()> {
trace!("Storing nonce");
let key = redis_key(format!("auth:oidc:{}", state.secret()));
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(Duration::try_minutes(5).unwrap().num_milliseconds())
.arg(nonce.secret())

View File

@ -63,7 +63,7 @@ pub async fn decode(
.eval()
.catch(&ctx)
.map_err(|e| anyhow!("JS error: {}", e))?;
buff_promise.finish()?;
() = buff_promise.finish()?;
let buff: rquickjs::Function = buff.get("Buffer")?;
let input = rquickjs::Object::new(ctx.clone())?;
@ -154,7 +154,7 @@ pub async fn encode(
.eval()
.catch(&ctx)
.map_err(|e| anyhow!("JS error: {}", e))?;
buff_promise.finish()?;
() = buff_promise.finish()?;
let buff: rquickjs::Function = buff.get("Buffer")?;
let input = rquickjs::Object::new(ctx.clone())?;

View File

@ -5,6 +5,7 @@ use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use chrono::Utc;
use handlebars::Handlebars;
use prometheus_client::encoding::EncodeLabelSet;
use prometheus_client::metrics::counter::Counter;
@ -359,6 +360,11 @@ async fn message_callback(
event.v4_migrate();
}
if let Some(rx_info) = &mut event.rx_info {
set_gateway_json(&rx_info.gateway_id, json);
rx_info.ns_time = Some(Utc::now().into());
}
tokio::spawn(uplink::deduplicate_uplink(
region_common_name,
region_config_id.to_string(),

View File

@ -1,9 +1,12 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use base64::{engine::general_purpose, Engine as _};
use prost::Message;
use reqwest::Client;
use tracing::{info, trace};
use super::Integration as IntegrationTrait;
@ -11,13 +14,25 @@ use crate::storage::application::AwsSnsConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
json: bool,
access_key_id: String,
secret_access_key: String,
region: String,
topic_arn: String,
client: reqwest::Client,
}
impl Integration {
@ -35,7 +50,6 @@ impl Integration {
access_key_id: conf.access_key_id.clone(),
secret_access_key: conf.secret_access_key.clone(),
region: conf.region.clone(),
client: reqwest::Client::new(),
})
}
@ -97,7 +111,7 @@ impl Integration {
headers.insert(reqwest::header::AUTHORIZATION, s.parse()?);
self.client
get_client()
.post(url)
.headers(headers)
.body(body)

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use anyhow::Result;
@ -16,8 +17,20 @@ use crate::storage::application::AzureServiceBusConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
json: bool,
uri: String,
key_name: String,
@ -31,7 +44,6 @@ impl Integration {
let kv = parse_connection_string(&conf.connection_string);
Ok(Integration {
timeout: Duration::from_secs(5),
json: match Encoding::try_from(conf.encoding)
.map_err(|_| anyhow!("Invalid encoding"))?
{
@ -65,7 +77,6 @@ impl Integration {
&(SystemTime::now() + Duration::from_secs(60 * 5)),
)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(AUTHORIZATION, token.parse()?);
@ -89,7 +100,7 @@ impl Integration {
);
info!(event = %event, dev_eui = %dev_eui, "Publishing event");
let res = client
let res = get_client()
.post(format!("{}/messages", self.uri))
.body(pl.to_string())
.headers(headers)
@ -307,7 +318,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
json: true,
uri: server.url(""),
key_name: "key-name".to_string(),

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::{Context, Result};
@ -16,12 +17,24 @@ use crate::storage::application::GcpPubSubConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
json: bool,
project_id: String,
topic_name: String,
service_account: gcp_auth::CustomServiceAccount,
timeout: Duration,
}
#[derive(Serialize)]
@ -57,7 +70,6 @@ impl Integration {
project_id: conf.project_id.clone(),
topic_name: conf.topic_name.clone(),
service_account,
timeout: Duration::from_secs(5),
})
}
@ -93,7 +105,6 @@ impl Integration {
.await
.context("Get GCP bearer token")?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -101,7 +112,7 @@ impl Integration {
format!("Bearer {}", token.as_str()).parse().unwrap(),
);
let res = client
let res = get_client()
.post(format!(
"https://pubsub.googleapis.com/v1/{}:publish",
topic

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,8 +13,20 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::HttpConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
endpoints: Vec<String>,
headers: HashMap<String, String>,
json: bool,
@ -24,7 +37,6 @@ impl Integration {
trace!("Initializing http integration");
Integration {
timeout: Duration::from_secs(5),
headers: conf.headers.clone(),
json: conf.json,
endpoints: conf
@ -36,7 +48,6 @@ impl Integration {
}
async fn post_event(&self, event: &str, b: Vec<u8>) -> Result<()> {
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
for (k, v) in &self.headers {
@ -51,7 +62,7 @@ impl Integration {
for url in &self.endpoints {
info!(event = %event, url = %url, "Posting event");
let res = client
let res = get_client()
.post(url)
.body(b.clone())
.query(&[("event", event)])
@ -214,7 +225,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoints: vec![server.url("/")],
headers: [("Foo".to_string(), "Bar".to_string())]
.iter()

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use crate::codec;
use crate::storage::application::IftttConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Serialize, Deserialize)]
struct Values {
#[serde(skip_serializing_if = "String::is_empty")]
@ -63,12 +77,16 @@ impl Integration {
format!("{}/trigger/{}/with/key/{}", self.server, event, self.key)
};
let client = Client::builder().timeout(Duration::from_secs(5)).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
info!(event = %event, "Sending event to IFTTT");
let res = client.post(url).json(&v).headers(headers).send().await?;
let res = get_client()
.post(url)
.json(&v)
.headers(headers)
.send()
.await?;
match res.error_for_status() {
Ok(_) => Ok(()),
Err(e) => {

View File

@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::fmt;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,8 +14,20 @@ use crate::storage::application::InfluxDbConfiguration;
use chirpstack_api::api::{InfluxDbPrecision, InfluxDbVersion};
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
endpoint: String,
version: InfluxDbVersion,
@ -36,7 +49,6 @@ impl Integration {
trace!("Initializing InfluxDB integration");
Ok(Integration {
timeout: Duration::from_secs(5),
endpoint: conf.endpoint.clone(),
version: InfluxDbVersion::try_from(conf.version)
.map_err(|_| anyhow!("Invalid version"))?,
@ -66,8 +78,6 @@ impl Integration {
measurements.sort();
let body = measurements.join("\n");
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "text/plain".parse().unwrap());
if self.version == InfluxDbVersion::Influxdb2 {
@ -87,7 +97,7 @@ impl Integration {
}
}
let mut req = client
let mut req = get_client()
.post(&self.endpoint)
.body(body)
.query(&query)
@ -477,7 +487,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/write"),
version: InfluxDbVersion::Influxdb1,
db: "testdb".into(),
@ -832,7 +841,6 @@ device_uplink,application_name=test-app,dev_eui=0102030405060708,device_name=tes
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/write"),
version: InfluxDbVersion::Influxdb2,
db: "".into(),

View File

@ -39,7 +39,7 @@ impl<'a> Integration<'a> {
templates.register_template_string("event_key", &conf.event_key)?;
let producer: FutureProducer = ClientConfig::new()
.set("bootstrap.servers", &conf.brokers.join(","))
.set("bootstrap.servers", conf.brokers.join(","))
.set("message.timeout.ms", "5000")
.set("allow.auto.create.topics", "true")
.set(

View File

@ -86,7 +86,7 @@ pub async fn save_geoloc_buffer(
};
let b = buffer.encode_to_vec();
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(ttl.num_milliseconds())
.arg(b)

View File

@ -1,4 +1,5 @@
use std::fmt;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use crate::gpstime::ToGpsTime;
use crate::uplink::helpers;
use lrwn::EUI64;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Error, Debug)]
pub enum Error {
#[error("No location")]
@ -25,7 +39,6 @@ pub enum Error {
pub struct ApiClient {
uri: String,
token: String,
timeout: Duration,
}
impl ApiClient {
@ -33,7 +46,6 @@ impl ApiClient {
ApiClient {
uri: uri.to_string(),
token: token.to_string(),
timeout: Duration::from_secs(5),
}
}
@ -117,7 +129,6 @@ impl ApiClient {
pub async fn uplink_send(&self, req: &UplinkRequest) -> Result<UplinkResponse> {
let endpoint = format!("{}/api/v1/device/send", self.uri);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -125,7 +136,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.headers(headers)
.json(req)
@ -138,7 +149,6 @@ impl ApiClient {
async fn request(&self, endpoint: &str, body: &str) -> Result<Response> {
let endpoint = format!("{}{}", self.uri, endpoint);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -146,7 +156,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.body(body.to_string())
.headers(headers)
@ -160,7 +170,6 @@ impl ApiClient {
async fn v3_request(&self, endpoint: &str, body: &str) -> Result<V3Response> {
let endpoint = format!("{}{}", self.uri, endpoint);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -168,7 +177,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.body(body.to_string())
.headers(headers)

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::MyDevicesConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Serialize)]
struct UplinkPayload {
#[serde(rename = "correlationID")]
@ -88,7 +102,6 @@ struct Location {
}
pub struct Integration {
timeout: Duration,
endpoint: String,
}
@ -96,7 +109,6 @@ impl Integration {
pub fn new(conf: &MyDevicesConfiguration) -> Integration {
trace!("Initializing myDevices integration");
Integration {
timeout: Duration::from_secs(5),
endpoint: conf.endpoint.clone(),
}
}
@ -120,11 +132,10 @@ impl IntegrationTrait for Integration {
let pl = UplinkPayload::from_uplink_event(pl);
let b = serde_json::to_string(&pl)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let req = client
let req = get_client()
.post(&self.endpoint)
.body(b)
.headers(headers)
@ -204,7 +215,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/"),
};

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,8 +13,20 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::PilotThingsConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
server: String,
token: String,
}
@ -23,7 +36,6 @@ impl Integration {
trace!("Initializing Pilot Things integration");
Integration {
timeout: Duration::from_secs(5),
server: conf.server.clone(),
token: conf.token.clone(),
}
@ -45,11 +57,10 @@ impl IntegrationTrait for Integration {
let pl = UplinkPayload::from_uplink_event(pl);
let b = serde_json::to_string(&pl)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.query(&[("token", self.token.clone())])
@ -182,7 +193,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
server: server.url(""),
token: "foo-token".into(),
};

View File

@ -1,4 +1,5 @@
use std::collections::{BTreeMap, HashMap};
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,9 +13,21 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::ThingsBoardConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
server: String,
timeout: Duration,
}
impl Integration {
@ -22,7 +35,6 @@ impl Integration {
trace!("Initializing ThingsBoard integration");
Integration {
timeout: Duration::from_secs(5),
server: conf.server.clone(),
}
}
@ -39,11 +51,10 @@ impl Integration {
let endpoint = format!("{}/api/v1/{}/attributes", self.server, access_token);
let b = serde_json::to_string(&attributes)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.headers(headers)
@ -65,11 +76,10 @@ impl Integration {
let endpoint = format!("{}/api/v1/{}/telemetry", self.server, access_token);
let b = serde_json::to_string(&telemetry)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.headers(headers)
@ -323,7 +333,6 @@ pub mod test {
let i = Integration {
server: server.url(""),
timeout: Duration::from_secs(5),
};
let mut vars: HashMap<String, String> = HashMap::new();

View File

@ -27,31 +27,40 @@ pub fn handle(
.as_ref()
.ok_or_else(|| anyhow!("parameters can not be None"))?;
if let gw::modulation::Parameters::Lora(pl) = mod_params {
let required_snr = config::get_required_snr_for_sf(pl.spreading_factor as u8)?;
let mut max_snr: f32 = 0.0;
// For non-LoRa modulations, the margin will be set to 0, as it can not be calculated.
// This way, at least the gw_cnt can be provided and the end-device is able to confirm
// it is still connected.
let margin = match mod_params {
gw::modulation::Parameters::Lora(pl) => {
let required_snr = config::get_required_snr_for_sf(pl.spreading_factor as u8)?;
let mut max_snr: f32 = 0.0;
for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
}
}
let margin = max_snr - required_snr;
if margin < 0.0 {
0.0
} else {
margin
}
}
let mut margin = max_snr - required_snr;
if margin < 0.0 {
margin = 0.0;
_ => {
warn!("Modulation does not provide margin to LinkCheckReq");
0.0
}
};
return Ok(Some(lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkCheckAns(lrwn::LinkCheckAnsPayload {
margin: margin as u8,
gw_cnt: ufs.rx_info_set.len() as u8,
}),
])));
}
warn!("Unsupported modulation for LinkCheckReq");
Ok(None)
// We always return a LinkCheckAns, even
Ok(Some(lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkCheckAns(lrwn::LinkCheckAnsPayload {
margin: margin as u8,
gw_cnt: ufs.rx_info_set.len() as u8,
}),
])))
}
#[cfg(test)]

View File

@ -16,7 +16,7 @@ pub async fn save_rx_info(rx_info: &internal::DeviceGatewayRxInfo) -> Result<()>
let ttl = conf.network.device_session_ttl.as_millis() as usize;
let b = rx_info.encode_to_vec();
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(ttl)
.arg(b)

View File

@ -11,7 +11,7 @@ pub async fn save(df: &internal::DownlinkFrame) -> Result<()> {
let b = df.encode_to_vec();
let key = redis_key(format!("frame:{}", df.downlink_id));
redis::cmd("SETEX")
() = redis::cmd("SETEX")
.arg(key)
.arg(30)
.arg(b)

View File

@ -12,7 +12,7 @@ pub async fn set_pending(dev_eui: &EUI64, cid: lrwn::CID, set: &lrwn::MACCommand
let ttl = conf.network.device_session_ttl.as_millis() as usize;
let b = set.to_vec()?;
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(ttl)
.arg(b)
@ -48,7 +48,7 @@ pub async fn get_pending(dev_eui: &EUI64, cid: lrwn::CID) -> Result<Option<lrwn:
pub async fn delete_pending(dev_eui: &EUI64, cid: lrwn::CID) -> Result<()> {
let key = redis_key(format!("device:{}:mac:pending:{}", dev_eui, cid.to_u8()));
redis::cmd("DEL")
() = redis::cmd("DEL")
.arg(key)
.query_async(&mut get_async_redis_conn().await?)
.await?;

View File

@ -78,7 +78,7 @@ pub async fn save_state(name: &str, state: &str) -> Result<()> {
let key = redis_key(format!("metrics:{{{}}}", name));
let ttl = get_ttl(Aggregation::MONTH);
redis::cmd("PSETEX")
() = redis::cmd("PSETEX")
.arg(key)
.arg(ttl.as_millis() as usize)
.arg(state)
@ -160,7 +160,7 @@ pub async fn save(name: &str, record: &Record, aggregations: &[Aggregation]) ->
info!(name = %name, aggregation = %a, "Metrics saved");
}
pipe.query_async(&mut get_async_redis_conn().await?).await?;
() = pipe.query_async(&mut get_async_redis_conn().await?).await?;
Ok(())
}

View File

@ -226,7 +226,7 @@ pub async fn reset_db() -> Result<()> {
#[cfg(test)]
pub async fn reset_redis() -> Result<()> {
redis::cmd("FLUSHDB")
() = redis::cmd("FLUSHDB")
.query_async(&mut get_async_redis_conn().await?)
.await?;
Ok(())

View File

@ -55,15 +55,15 @@ pub async fn save(ds: &internal::PassiveRoamingDeviceSession) -> Result<()> {
// * We need to be able to lookup the session using the DevAddr (potentially
// using the MIC validation).
// * We need to be able to stop a passive-roaming session given a DevEUI.
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("SADD")
.arg(&dev_addr_key)
.arg(&sess_id.to_string())
.arg(sess_id.to_string())
.ignore()
.cmd("SADD")
.arg(&dev_eui_key)
.arg(&sess_id.to_string())
.arg(sess_id.to_string())
.ignore()
.cmd("PEXPIRE")
.arg(&dev_addr_key)
@ -105,7 +105,7 @@ pub async fn get(id: Uuid) -> Result<internal::PassiveRoamingDeviceSession, Erro
pub async fn delete(id: Uuid) -> Result<()> {
let key = redis_key(format!("pr:sess:{{{}}}", id));
redis::cmd("DEL")
() = redis::cmd("DEL")
.arg(&key)
.query_async(&mut get_async_redis_conn().await?)
.await?;

View File

@ -14,7 +14,7 @@ pub async fn log_request(pl: &stream::ApiRequestLog) -> Result<()> {
let key = redis_key("api:stream:request".to_string());
let b = pl.encode_to_vec();
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.api_request_log_max_history)

View File

@ -37,7 +37,7 @@ pub async fn log_request(pl: stream::BackendInterfacesRequest) -> Result<()> {
let key = redis_key("backend_interfaces:stream:request".to_string());
let b = pl.encode_to_vec();
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.backend_interfaces_log_max_history)

View File

@ -21,7 +21,7 @@ pub async fn log_event_for_device(typ: &str, dev_eui: &str, b: &[u8]) -> Result<
// per device stream
if conf.monitoring.per_device_event_log_max_history > 0 {
let key = redis_key(format!("device:{{{}}}:stream:event", dev_eui));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)
@ -42,7 +42,7 @@ pub async fn log_event_for_device(typ: &str, dev_eui: &str, b: &[u8]) -> Result<
// global device stream
if conf.monitoring.device_event_log_max_history > 0 {
let key = redis_key("device:stream:event".to_string());
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.device_event_log_max_history)

View File

@ -41,7 +41,7 @@ pub async fn log_uplink_for_gateways(ufl: &stream::UplinkFrameLog) -> Result<()>
if conf.monitoring.per_gateway_frame_log_max_history > 0 {
let key = redis_key(format!("gw:{{{}}}:stream:frame", gateway_id));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)
@ -62,7 +62,7 @@ pub async fn log_uplink_for_gateways(ufl: &stream::UplinkFrameLog) -> Result<()>
// global gateway stream
if conf.monitoring.gateway_frame_log_max_history > 0 {
let key = redis_key("gw:stream:frame".to_string());
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.gateway_frame_log_max_history)
@ -89,7 +89,7 @@ pub async fn log_downlink_for_gateway(dfl: &stream::DownlinkFrameLog) -> Result<
// per gateway stream
if conf.monitoring.per_gateway_frame_log_max_history > 0 {
let key = redis_key(format!("gw:{{{}}}:stream:frame", dfl.gateway_id));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)
@ -110,7 +110,7 @@ pub async fn log_downlink_for_gateway(dfl: &stream::DownlinkFrameLog) -> Result<
// global gateway stream
if conf.monitoring.gateway_frame_log_max_history > 0 {
let key = redis_key("gw:stream:frame".to_string());
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.gateway_frame_log_max_history)
@ -137,7 +137,7 @@ pub async fn log_uplink_for_device(ufl: &stream::UplinkFrameLog) -> Result<()> {
if conf.monitoring.per_device_frame_log_max_history > 0 {
let key = redis_key(format!("device:{{{}}}:stream:frame", ufl.dev_eui));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)
@ -158,7 +158,7 @@ pub async fn log_uplink_for_device(ufl: &stream::UplinkFrameLog) -> Result<()> {
// global device stream
if conf.monitoring.device_frame_log_max_history > 0 {
let key = redis_key("device:stream:frame".to_string());
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.device_frame_log_max_history)
@ -185,7 +185,7 @@ pub async fn log_downlink_for_device(dfl: &stream::DownlinkFrameLog) -> Result<(
if conf.monitoring.per_device_frame_log_max_history > 0 {
let key = redis_key(format!("device:{{{}}}:stream:frame", dfl.dev_eui));
redis::pipe()
() = redis::pipe()
.atomic()
.cmd("XADD")
.arg(&key)
@ -206,7 +206,7 @@ pub async fn log_downlink_for_device(dfl: &stream::DownlinkFrameLog) -> Result<(
// global device stream
if conf.monitoring.device_frame_log_max_history > 0 {
let key = redis_key("device:stream:frame".to_string());
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.device_frame_log_max_history)

View File

@ -11,7 +11,7 @@ pub async fn log_uplink(up: &stream::UplinkMeta) -> Result<()> {
if conf.monitoring.meta_log_max_history > 0 {
let key = redis_key("stream:meta".to_string());
let b = up.encode_to_vec();
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.meta_log_max_history)
@ -32,7 +32,7 @@ pub async fn log_downlink(down: &stream::DownlinkMeta) -> Result<()> {
let key = redis_key("stream:meta".to_string());
let b = down.encode_to_vec();
redis::cmd("XADD")
() = redis::cmd("XADD")
.arg(&key)
.arg("MAXLEN")
.arg(conf.monitoring.meta_log_max_history)

View File

@ -12,6 +12,6 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/google/go-cmp v0.5.9 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
)

View File

@ -12,11 +12,11 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=

View File

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

View File

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

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.79.0"
channel = "1.81.0"
components = ["rustfmt", "clippy"]
profile = "default"

View File

@ -7,19 +7,21 @@ pkgs.mkShell {
buildInputs = [
pkgs.cacert
pkgs.rustup
pkgs.protobuf
pkgs.perl
pkgs.cmake
pkgs.clang
pkgs.postgresql # needed to build the diesel cli utility
pkgs.protobuf # api
pkgs.go # go api
pkgs.nodejs # js api + ui
pkgs.yarn
pkgs.protoc-gen-grpc-web # grpc-web api
pkgs.protoc-gen-go # go api
pkgs.protoc-gen-go-grpc
pkgs.protoc-gen-go-grpc # go api
pkgs.protoc-gen-grpc-web # grpc-web api
pkgs.nodejs # js api + ui
pkgs.yarn # ui
pkgs.openssl
pkgs.sqlite
pkgs.sqlite # sqlite binary + library for diesel
pkgs.postgresql # psql binary + library for diesel
pkgs.cargo-cross # cross-compiling
pkgs.diesel-cli # diesel cli
];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.llvmPackages.libclang.lib}/lib/clang/${pkgs.llvmPackages.libclang.version}/include";

View File

@ -1,6 +1,6 @@
{
"name": "chirpstack-ui",
"version": "4.11.0-test.1",
"version": "4.11.1",
"private": true,
"type": "module",
"scripts": {

View File

@ -2082,9 +2082,9 @@ ms@2.1.2:
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nanoid@^3.3.7:
version "3.3.7"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
natural-compare@^1.4.0:
version "1.4.0"