mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-04-17 20:50:14 +00:00
Compare commits
8 Commits
v4.0.0-rc.
...
v4.0.0-rc.
Author | SHA1 | Date | |
---|---|---|---|
ca2961c7b6 | |||
63b0af6cf3 | |||
d97da8ed50 | |||
3b297ef221 | |||
e917f8ea49 | |||
424306ab41 | |||
613f4562a2 | |||
bf6df9c845 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -13,11 +13,7 @@
|
||||
**/target
|
||||
|
||||
# Certificates
|
||||
/chirpstack/configuration/certs/*.crt
|
||||
/chirpstack/configuration/certs/*.key
|
||||
/chirpstack/configuration/certs/*.trust
|
||||
/chirpstack/configuration/certs/*.pem
|
||||
/chirpstack/configuration/certs/*.csr
|
||||
/chirpstack/configuration/certs/*
|
||||
/chirpstack/configuration/private_*.toml
|
||||
|
||||
# UI
|
||||
|
37
Cargo.lock
generated
37
Cargo.lock
generated
@ -635,7 +635,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "backend"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
dependencies = [
|
||||
"aes-kw",
|
||||
"anyhow",
|
||||
@ -879,7 +879,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chirpstack"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
dependencies = [
|
||||
"aes 0.7.5",
|
||||
"anyhow",
|
||||
@ -958,7 +958,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chirpstack_api"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"pbjson",
|
||||
@ -1118,9 +1118,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
|
||||
checksum = "1079fb8528d9f9c888b1e8aa651e6e079ade467323d58f75faf1d30b1808f540"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -2222,7 +2222,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lrwn"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
dependencies = [
|
||||
"aes 0.7.5",
|
||||
"anyhow",
|
||||
@ -2582,15 +2582,6 @@ version = "6.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4"
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "p12"
|
||||
version = "0.6.3"
|
||||
@ -2953,21 +2944,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prometheus-client"
|
||||
version = "0.16.0"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825"
|
||||
checksum = "3c473049631c233933d6286c88bbb7be30e62ec534cf99a9ae0079211f7fa603"
|
||||
dependencies = [
|
||||
"dtoa 1.0.2",
|
||||
"itoa 1.0.2",
|
||||
"owning_ref",
|
||||
"parking_lot",
|
||||
"prometheus-client-derive-text-encode",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prometheus-client-derive-text-encode"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652"
|
||||
checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3803,12 +3794,6 @@ dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.8.4"
|
||||
|
2
api/grpc-web/package.json
vendored
2
api/grpc-web/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@chirpstack/chirpstack-api-grpc-web",
|
||||
"version": "4.0.0-rc.2",
|
||||
"version": "4.0.0-rc.3",
|
||||
"description": "Chirpstack gRPC-web API",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
2
api/js/package.json
vendored
2
api/js/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@chirpstack/chirpstack-api",
|
||||
"version": "4.0.0-rc.2",
|
||||
"version": "4.0.0-rc.3",
|
||||
"description": "Chirpstack JS and TS API",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
2
api/python/src/setup.py
vendored
2
api/python/src/setup.py
vendored
@ -18,7 +18,7 @@ CLASSIFIERS = [
|
||||
|
||||
setup(
|
||||
name='chirpstack-api',
|
||||
version = "4.0.0-rc.2",
|
||||
version = "4.0.0-rc.3",
|
||||
url='https://github.com/brocaar/chirpstack-api',
|
||||
author='Orne Brocaar',
|
||||
author_email='info@brocaar.com',
|
||||
|
2
api/rust/Cargo.toml
vendored
2
api/rust/Cargo.toml
vendored
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "chirpstack_api"
|
||||
description = "ChirpStack Protobuf / gRPC API definitions."
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
authors = ["Orne Brocaar <info@brocaar.com>"]
|
||||
license = "MIT"
|
||||
homepage = "https://www.chirpstack.io"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "backend"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
authors = ["Orne Brocaar <info@brocaar.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
@ -1,4 +0,0 @@
|
||||
[Service]
|
||||
Environment="MQTT_BROKER_HOST=localhost"
|
||||
Environment="POSTGRESQL_HOST=localhost"
|
||||
Environment="REDIS_HOST=localhost"
|
@ -23,6 +23,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}
|
||||
cp -a * %{buildroot}
|
||||
sed -i "s/\$MQTT_BROKER_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
|
||||
sed -i "s/\$POSTGRESQL_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
|
||||
sed -i "s/\$REDIS_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
@ -32,4 +35,3 @@ rm -rf %{buildroot}
|
||||
%{_bindir}/*
|
||||
/lib/systemd/system/chirpstack.service
|
||||
%config /etc/chirpstack/*
|
||||
%config /etc/systemd/system/chirpstack.service.d/*
|
||||
|
@ -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.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
authors = ["Orne Brocaar <info@brocaar.com>"]
|
||||
edition = "2021"
|
||||
publish = false
|
||||
@ -107,7 +107,7 @@ base64 = "0.13"
|
||||
async-recursion = "1.0"
|
||||
regex = "1"
|
||||
petgraph = "0.6"
|
||||
prometheus-client = "0.16"
|
||||
prometheus-client = "0.18"
|
||||
pin-project = "1.0"
|
||||
|
||||
# Development and testing
|
||||
@ -120,13 +120,8 @@ bytes = "1.1"
|
||||
assets = [
|
||||
["target/release/chirpstack", "usr/bin/", "755"],
|
||||
["configuration/*.toml", "etc/chirpstack/", "640"],
|
||||
["configuration/certs/*.json", "etc/chirpstack/certs", "640"],
|
||||
["debian/environment.conf", "etc/systemd/system/chirpstack.service.d/environment.conf", "640"],
|
||||
]
|
||||
conf-files = [
|
||||
"/etc/chirpstack/certs/ca-config.json",
|
||||
"/etc/chirpstack/certs/ca-csr.json",
|
||||
"/etc/chirpstack/certs/mqtt-server.json",
|
||||
"/etc/chirpstack/chirpstack.toml",
|
||||
"/etc/chirpstack/region_as923.toml",
|
||||
"/etc/chirpstack/region_as923_2.toml",
|
||||
@ -156,7 +151,6 @@ conf-files = [
|
||||
"/etc/chirpstack/region_us915_6.toml",
|
||||
"/etc/chirpstack/region_us915_7.toml",
|
||||
]
|
||||
depends = "$auto, golang-cfssl"
|
||||
suggests = "postgresql, mosquitto, redis"
|
||||
maintainer-scripts = "debian/"
|
||||
systemd-units = { enable = true }
|
||||
@ -167,7 +161,6 @@ package = "chirpstack"
|
||||
[package.metadata.rpm.files]
|
||||
"configuration/" = { path = "/etc/chirpstack/" }
|
||||
"chirpstack.service" = { path = "/lib/systemd/system/chirpstack.service" }
|
||||
"chirpstack.env" = { path = "/etc/systemd/system/chirpstack.service.d/environment" }
|
||||
|
||||
[package.metadata.rpm.cargo]
|
||||
buildflags = ["--release"]
|
||||
|
@ -111,14 +111,8 @@ test:
|
||||
test-lrwn:
|
||||
cd ../lrwn && make test
|
||||
|
||||
test-server: debug-amd64 configuration/certs/ca.pem
|
||||
test-server: debug-amd64
|
||||
../target/debug/chirpstack -c ./configuration
|
||||
|
||||
dbshell:
|
||||
psql -h postgres -U chirpstack chirpstack
|
||||
|
||||
configuration/certs/ca.pem:
|
||||
cfssl gencert -initca configuration/certs/ca-csr.json | cfssljson -bare configuration/certs/ca
|
||||
|
||||
configuration/certs/mqtt-server.pem: configuration/certs/ca.pem
|
||||
cfssl gencert -ca configuration/certs/ca.pem -ca-key configuration/certs/ca-key.pem -config configuration/certs/ca-config.json -profile server configuration/certs/mqtt-server.json | cfssljson -bare configuration/certs/mqtt-server
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"signing": {
|
||||
"default": {
|
||||
"expiry": "8760h"
|
||||
},
|
||||
"profiles": {
|
||||
"server": {
|
||||
"expiry": "8760h",
|
||||
"usages": [
|
||||
"signing",
|
||||
"key encipherment",
|
||||
"server auth"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"CN": "ChirpStack CA",
|
||||
"key": {
|
||||
"algo": "rsa",
|
||||
"size": 4096
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"CN": "mqtt-broker",
|
||||
"hosts": [
|
||||
"*"
|
||||
],
|
||||
"key": {
|
||||
"algo": "rsa",
|
||||
"size": 4096
|
||||
}
|
||||
}
|
@ -97,19 +97,9 @@
|
||||
secret="you-must-replace-this"
|
||||
|
||||
|
||||
[gateway]
|
||||
client_cert_lifetime="365days"
|
||||
ca_cert="configuration/certs/ca.pem"
|
||||
ca_key="configuration/certs/ca-key.pem"
|
||||
|
||||
[integration]
|
||||
enabled=["mqtt"]
|
||||
|
||||
[integration.mqtt]
|
||||
server="tcp://$MQTT_BROKER_HOST:1883/"
|
||||
json=true
|
||||
|
||||
[integration.mqtt.client]
|
||||
client_cert_lifetime="365days"
|
||||
ca_cert="configuration/certs/ca.pem"
|
||||
ca_key="configuration/certs/ca-key.pem"
|
||||
|
@ -1,4 +0,0 @@
|
||||
[Service]
|
||||
Environment="MQTT_BROKER_HOST=localhost"
|
||||
Environment="POSTGRESQL_HOST=localhost"
|
||||
Environment="REDIS_HOST=localhost"
|
@ -3,18 +3,11 @@
|
||||
# Set config-file permissions
|
||||
chown -R chirpstack:chirpstack /etc/chirpstack
|
||||
chmod 750 /etc/chirpstack
|
||||
chmod 750 /etc/chirpstack/certs
|
||||
chmod 640 /etc/chirpstack/*.toml
|
||||
|
||||
# Generate certificates
|
||||
CERTROOT=/etc/chirpstack/certs
|
||||
|
||||
if [ ! -f $CERTROOT/ca.pem ]; then
|
||||
cfssl gencert -initca $CERTROOT/ca-csr.json | cfssljson -bare $CERTROOT/ca
|
||||
fi
|
||||
|
||||
if [ ! -f $CERTROOT/mqtt-server.pem ]; then
|
||||
cfssl gencert -ca $CERTROOT/ca.pem -ca-key $CERTROOT/ca-key.pem -config $CERTROOT/ca-config.json -profile server $CERTROOT/mqtt-server.json | cfssljson -bare $CERTROOT/mqtt-server
|
||||
fi
|
||||
# Set environment variables to localhost
|
||||
sed -i "s/\$MQTT_BROKER_HOST/localhost/" /etc/chirpstack/*.toml
|
||||
sed -i "s/\$POSTGRESQL_HOST/localhost/" /etc/chirpstack/*.toml
|
||||
sed -i "s/\$REDIS_HOST/localhost/" /etc/chirpstack/*.toml
|
||||
|
||||
#DEBHELPER#
|
||||
|
@ -104,6 +104,12 @@ pub fn run() {
|
||||
# This defines how long (after generating) the certificate remains valid.
|
||||
client_cert_lifetime="{{ gateway.client_cert_lifetime }}"
|
||||
|
||||
# Allow unknown gateways.
|
||||
#
|
||||
# If set to true, then uplinks received from gateways not configured in
|
||||
# ChirpStack will be allowed.
|
||||
allow_unknown_gateways={{ gateway.allow_unknown_gateways }}
|
||||
|
||||
|
||||
# Network related configuration.
|
||||
[network]
|
||||
|
@ -132,6 +132,7 @@ pub struct Gateway {
|
||||
pub client_cert_lifetime: Duration,
|
||||
pub ca_cert: String,
|
||||
pub ca_key: String,
|
||||
pub allow_unknown_gateways: bool,
|
||||
}
|
||||
|
||||
impl Default for Gateway {
|
||||
@ -140,6 +141,7 @@ impl Default for Gateway {
|
||||
client_cert_lifetime: Duration::from_secs(60 * 60 * 24 * 365),
|
||||
ca_cert: "".to_string(),
|
||||
ca_key: "".to_string(),
|
||||
allow_unknown_gateways: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,12 @@ async fn test_fns_uplink() {
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
time: Some(recv_time.into()),
|
||||
location: Some(common::Location {
|
||||
latitude: 0.0,
|
||||
longitude: 0.0,
|
||||
altitude: 0.0,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
|
@ -98,6 +98,7 @@ async fn test_gateway_filtering() {
|
||||
|
||||
let mut rx_info_a = gw::UplinkRxInfo {
|
||||
gateway_id: gw_a.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info_a.set_metadata_string("region_name", "eu868");
|
||||
@ -105,6 +106,7 @@ async fn test_gateway_filtering() {
|
||||
|
||||
let mut rx_info_b = gw::UplinkRxInfo {
|
||||
gateway_id: gw_b.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info_b.set_metadata_string("region_name", "eu868");
|
||||
@ -247,6 +249,7 @@ async fn test_lorawan_10_errors() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -426,6 +429,7 @@ async fn test_lorawan_11_errors() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -575,6 +579,7 @@ async fn test_lorawan_10_skip_f_cnt() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -763,6 +768,7 @@ async fn test_lorawan_10_device_disabled() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -881,6 +887,7 @@ async fn test_lorawan_10_uplink() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -1495,6 +1502,7 @@ async fn test_lorawan_11_uplink() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -1728,6 +1736,7 @@ async fn test_lorawan_10_rx_delay() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -1936,6 +1945,7 @@ async fn test_lorawan_10_mac_commands() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -2300,6 +2310,7 @@ async fn test_lorawan_11_mac_commands() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -2489,6 +2500,7 @@ async fn test_lorawan_10_device_queue() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -2957,6 +2969,7 @@ async fn test_lorawan_11_device_queue() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -3429,6 +3442,7 @@ async fn test_lorawan_10_adr() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -4266,6 +4280,7 @@ async fn test_lorawan_10_device_status_request() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -4524,6 +4539,7 @@ async fn test_lorawan_11_receive_window_selection() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
|
@ -67,6 +67,7 @@ async fn test_fns() {
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
time: Some(recv_time.into()),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -327,6 +328,7 @@ async fn test_sns() {
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: "0302030405060708".to_string(),
|
||||
time: Some(recv_time.into()),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
|
@ -106,6 +106,7 @@ async fn test_gateway_filtering() {
|
||||
|
||||
let mut rx_info_a = gw::UplinkRxInfo {
|
||||
gateway_id: gw_a.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info_a.set_metadata_string("region_name", "eu868");
|
||||
@ -113,6 +114,7 @@ async fn test_gateway_filtering() {
|
||||
|
||||
let mut rx_info_b = gw::UplinkRxInfo {
|
||||
gateway_id: gw_b.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info_b.set_metadata_string("region_name", "eu868");
|
||||
@ -267,6 +269,7 @@ async fn test_lorawan_10() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
@ -910,6 +913,7 @@ async fn test_lorawan_11() {
|
||||
|
||||
let mut rx_info = gw::UplinkRxInfo {
|
||||
gateway_id: gw.gateway_id.to_string(),
|
||||
location: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
rx_info.set_metadata_string("region_name", "eu868");
|
||||
|
@ -13,7 +13,7 @@ use uuid::Uuid;
|
||||
|
||||
use crate::config;
|
||||
use crate::framelog;
|
||||
use crate::storage::{gateway, get_redis_conn, redis_key};
|
||||
use crate::storage::{error::Error as StorageError, gateway, get_redis_conn, redis_key};
|
||||
use chirpstack_api::{api, common, gw};
|
||||
use lrwn::region::CommonName;
|
||||
use lrwn::{MType, PhyPayload, EUI64};
|
||||
@ -304,11 +304,19 @@ pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -
|
||||
}
|
||||
|
||||
async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
|
||||
let conf = config::get();
|
||||
for rx_info in &mut ufs.rx_info_set {
|
||||
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
|
||||
let gw_meta = match gateway::get_meta(&gw_id).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
if conf.gateway.allow_unknown_gateways {
|
||||
if let StorageError::NotFound(_) = e {
|
||||
ufs.gateway_private_map.insert(gw_id, false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
error!(
|
||||
gateway_id = gw_id.to_string().as_str(),
|
||||
error = format!("{}", e).as_str(),
|
||||
@ -318,7 +326,6 @@ async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let mut rx_info = rx_info.clone();
|
||||
rx_info.location = Some(common::Location {
|
||||
latitude: gw_meta.latitude,
|
||||
longitude: gw_meta.longitude,
|
||||
|
@ -3,7 +3,7 @@ name = "lrwn"
|
||||
description = "Library for encoding / decoding LoRaWAN frames."
|
||||
homepage = "https://www.chirpstack.io"
|
||||
license = "MIT"
|
||||
version = "4.0.0-rc.2"
|
||||
version = "4.0.0-rc.3"
|
||||
authors = ["Orne Brocaar <info@brocaar.com>"]
|
||||
edition = "2018"
|
||||
repository = "https://github.com/chirpstack/chirpstack"
|
||||
|
@ -1107,7 +1107,7 @@ impl Region for Configuration {
|
||||
// use the ChMask of the first LinkADRReqPayload, besides
|
||||
// turning off all 125 kHz this payload contains the ChMask
|
||||
// for the last block of channels.
|
||||
if c > 64 {
|
||||
if c >= 64 {
|
||||
out[0].ch_mask.set(c % 16, true);
|
||||
continue;
|
||||
}
|
||||
@ -1419,11 +1419,11 @@ pub mod test {
|
||||
expected_uplink_channels: c.get_uplink_channel_indices(),
|
||||
expected_link_adr_req_payloads: vec![],
|
||||
},
|
||||
// Only activate 0 - 7.
|
||||
// Only activate 0 - 7 + 64.
|
||||
Test {
|
||||
device_channels: c.get_uplink_channel_indices(),
|
||||
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
|
||||
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
|
||||
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
|
||||
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
|
||||
expected_link_adr_req_payloads: vec![
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
@ -1432,7 +1432,10 @@ pub mod test {
|
||||
ch_mask_cntl: 7,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([false; 16]),
|
||||
ch_mask: ChMask::new([
|
||||
true, false, false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
]),
|
||||
},
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
@ -1448,6 +1451,42 @@ pub mod test {
|
||||
},
|
||||
],
|
||||
},
|
||||
// Only activate 0 - 15 + 64 & 65.
|
||||
Test {
|
||||
device_channels: c.get_uplink_channel_indices(),
|
||||
enabled_channels: vec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
|
||||
],
|
||||
expected_uplink_channels: vec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
|
||||
],
|
||||
expected_link_adr_req_payloads: vec![
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
tx_power: 0,
|
||||
redundancy: Redundancy {
|
||||
ch_mask_cntl: 7,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([
|
||||
true, true, false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
]),
|
||||
},
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
tx_power: 0,
|
||||
redundancy: Redundancy {
|
||||
ch_mask_cntl: 0,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([
|
||||
true, true, true, true, true, true, true, true, true, true, true, true,
|
||||
true, true, true, true,
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
for tst in &tests {
|
||||
|
@ -797,7 +797,7 @@ impl Region for Configuration {
|
||||
// use the ChMask of the first LinkADRReqPayload, besides
|
||||
// turning off all 125 kHz this payload contains the ChMask
|
||||
// for the last block of channels.
|
||||
if c > 64 {
|
||||
if c >= 64 {
|
||||
out[0].ch_mask.set(c % 16, true);
|
||||
continue;
|
||||
}
|
||||
@ -1111,11 +1111,11 @@ pub mod test {
|
||||
expected_uplink_channels: c.get_uplink_channel_indices(),
|
||||
expected_link_adr_req_payloads: vec![],
|
||||
},
|
||||
// Only activate 0 - 7.
|
||||
// Only activate 0 - 7 + 64.
|
||||
Test {
|
||||
device_channels: c.get_uplink_channel_indices(),
|
||||
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
|
||||
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
|
||||
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
|
||||
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
|
||||
expected_link_adr_req_payloads: vec![
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
@ -1124,7 +1124,10 @@ pub mod test {
|
||||
ch_mask_cntl: 7,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([false; 16]),
|
||||
ch_mask: ChMask::new([
|
||||
true, false, false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
]),
|
||||
},
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
@ -1140,6 +1143,42 @@ pub mod test {
|
||||
},
|
||||
],
|
||||
},
|
||||
// Only activate 0 - 15 + 64 & 65.
|
||||
Test {
|
||||
device_channels: c.get_uplink_channel_indices(),
|
||||
enabled_channels: vec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
|
||||
],
|
||||
expected_uplink_channels: vec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
|
||||
],
|
||||
expected_link_adr_req_payloads: vec![
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
tx_power: 0,
|
||||
redundancy: Redundancy {
|
||||
ch_mask_cntl: 7,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([
|
||||
true, true, false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
]),
|
||||
},
|
||||
LinkADRReqPayload {
|
||||
dr: 0,
|
||||
tx_power: 0,
|
||||
redundancy: Redundancy {
|
||||
ch_mask_cntl: 0,
|
||||
nb_rep: 0,
|
||||
},
|
||||
ch_mask: ChMask::new([
|
||||
true, true, true, true, true, true, true, true, true, true, true, true,
|
||||
true, true, true, true,
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
for tst in &tests {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chirpstack-ui",
|
||||
"version": "4.0.0-rc.2",
|
||||
"version": "4.0.0-rc.3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@ant-design/colors": "^6.0.0",
|
||||
|
Reference in New Issue
Block a user