diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index fcfb2de5..62b0b155 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -419,12 +419,6 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" -[[package]] -name = "cassowary" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" - [[package]] name = "cast" version = "0.3.0" @@ -638,19 +632,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "compact_str" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" -dependencies = [ - "castaway", - "cfg-if", - "itoa", - "ryu", - "static_assertions", -] - [[package]] name = "compact_str" version = "0.8.1" @@ -665,6 +646,29 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "compact_str" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie" version = "0.18.1" @@ -811,22 +815,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "crossterm" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" -dependencies = [ - "bitflags 2.11.0", - "crossterm_winapi", - "libc", - "mio 0.8.11", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - [[package]] name = "crossterm" version = "0.28.1" @@ -843,6 +831,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags 2.11.0", + "crossterm_winapi", + "derive_more", + "document-features", + "mio 1.2.0", + "parking_lot", + "rustix 1.1.4", + "signal-hook", + "signal-hook-mio", + "winapi", +] + [[package]] name = "crossterm_winapi" version = "0.9.1" @@ -936,7 +942,7 @@ dependencies = [ "log", "signal-hook", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -967,7 +973,7 @@ dependencies = [ "serde_json", "time", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.14", "xi-unicode", ] @@ -1003,8 +1009,18 @@ version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", ] [[package]] @@ -1020,13 +1036,37 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core 0.23.0", "quote", "syn 2.0.117", ] @@ -1076,6 +1116,28 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.117", +] + [[package]] name = "digest" version = "0.10.7" @@ -1121,6 +1183,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + [[package]] name = "dryoc" version = "0.6.2" @@ -1198,7 +1269,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f43e744e4ea338060faee68ed933e46e722fb7f3617e722a5772d7e856d8b3ce" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.117", @@ -1286,6 +1357,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1505,10 +1582,19 @@ name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.2.0", ] [[package]] @@ -1840,6 +1926,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instability" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb2d60ef19920a3a9193c3e371f726ec1dafc045dac788d0fb3704272458971" +dependencies = [ + "darling 0.23.0", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "ip_network" version = "0.4.1" @@ -1886,18 +1985,18 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] @@ -1919,7 +2018,7 @@ dependencies = [ "combine", "jni-sys 0.3.1", "log", - "thiserror", + "thiserror 1.0.69", "walkdir", "windows-sys 0.45.0", ] @@ -1974,6 +2073,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kasuari" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899" +dependencies = [ + "hashbrown 0.16.1", + "portable-atomic", + "thiserror 2.0.18", +] + [[package]] name = "kqueue" version = "1.1.1" @@ -2045,6 +2155,15 @@ dependencies = [ "redox_syscall 0.7.4", ] +[[package]] +name = "line-clipping" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f50e8f47623268b5407192d26876c4d7f89d686ca130fdc53bced4814cd29f8" +dependencies = [ + "bitflags 2.11.0", +] + [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -2063,6 +2182,12 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.14" @@ -2108,7 +2233,7 @@ dependencies = [ "nix", "serde", "serde_cbor", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -2132,7 +2257,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror", + "thiserror 1.0.69", "toml", "toml_edit 0.25.11+spec-1.1.0", "tracing", @@ -2169,7 +2294,6 @@ dependencies = [ "anyhow", "clap", "default-net", - "libc", "lqos_config", "lqos_utils", "serde", @@ -2224,7 +2348,7 @@ dependencies = [ "rand 0.8.5", "serde", "surge-ping", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -2275,7 +2399,7 @@ dependencies = [ "parking_lot", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "timerfd", "tracing", ] @@ -2349,7 +2473,7 @@ dependencies = [ "nix", "once_cell", "parking_lot", - "thiserror", + "thiserror 1.0.69", "tracing", "zerocopy", ] @@ -2378,7 +2502,7 @@ dependencies = [ "lqos_config", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2396,7 +2520,7 @@ dependencies = [ "serde", "serde_json", "smallvec", - "thiserror", + "thiserror 1.0.69", "tracing", "zerocopy", ] @@ -2454,9 +2578,9 @@ dependencies = [ "sha256", "signal-hook", "smallvec", - "strum", + "strum 0.26.3", "sysinfo", - "thiserror", + "thiserror 1.0.69", "timerfd", "tokio", "tokio-tungstenite", @@ -2474,7 +2598,7 @@ name = "lqtop" version = "0.1.0" dependencies = [ "anyhow", - "crossterm 0.27.0", + "crossterm 0.29.0", "ctrlc", "lqos_bus", "lqos_utils", @@ -2497,11 +2621,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.5" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +checksum = "7f66e8d5d03f609abc3a39e6f08e4164ebf1447a732906d39eb9b99b7919ef39" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.16.1", ] [[package]] @@ -2664,7 +2788,7 @@ dependencies = [ "anyhow", "byteorder", "paste", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3313,22 +3437,65 @@ checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" [[package]] name = "ratatui" -version = "0.26.3" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f44c9e68fd46eda15c646fbb85e1040b657a58cdc8c98db1d97a55930d991eef" +checksum = "d1ce67fb8ba4446454d1c8dbaeda0557ff5e94d39d5e5ed7f10a65eb4c8266bc" +dependencies = [ + "instability", + "ratatui-core", + "ratatui-crossterm", + "ratatui-widgets", +] + +[[package]] +name = "ratatui-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef8dea09a92caaf73bff7adb70b76162e5937524058a7e5bff37869cbbec293" dependencies = [ "bitflags 2.11.0", - "cassowary", - "compact_str 0.7.1", - "crossterm 0.27.0", - "itertools 0.12.1", + "compact_str 0.9.0", + "hashbrown 0.16.1", + "indoc", + "itertools 0.14.0", + "kasuari", "lru", - "paste", - "stability", - "strum", + "strum 0.27.2", + "thiserror 2.0.18", "unicode-segmentation", "unicode-truncate", - "unicode-width", + "unicode-width 0.2.2", +] + +[[package]] +name = "ratatui-crossterm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "577c9b9f652b4c121fb25c6a391dd06406d3b092ba68827e6d2f09550edc54b3" +dependencies = [ + "cfg-if", + "crossterm 0.29.0", + "instability", + "ratatui-core", +] + +[[package]] +name = "ratatui-widgets" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7dbfa023cd4e604c2553483820c5fe8aa9d71a42eea5aa77c6e7f35756612db" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.16.1", + "indoc", + "instability", + "itertools 0.14.0", + "line-clipping", + "ratatui-core", + "strum 0.27.2", + "time", + "unicode-segmentation", + "unicode-width 0.2.2", ] [[package]] @@ -3818,7 +3985,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" dependencies = [ "libc", - "mio 0.8.11", "mio 1.2.0", "signal-hook", ] @@ -3867,16 +4033,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "stability" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" -dependencies = [ - "quote", - "syn 2.0.117", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3901,7 +4057,16 @@ version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros", + "strum_macros 0.26.4", +] + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros 0.27.2", ] [[package]] @@ -3917,6 +4082,18 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "subtle" version = "2.6.1" @@ -3934,7 +4111,7 @@ dependencies = [ "pnet_packet", "rand 0.9.4", "socket2", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -4062,7 +4239,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", ] [[package]] @@ -4076,6 +4262,17 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "thread_local" version = "1.1.9" @@ -4441,7 +4638,7 @@ dependencies = [ "native-tls", "rand 0.8.5", "sha1", - "thiserror", + "thiserror 1.0.69", "utf-8", ] @@ -4481,7 +4678,7 @@ dependencies = [ "serde", "serde_cbor", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "tracing-subscriber", @@ -4508,13 +4705,13 @@ checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" [[package]] name = "unicode-truncate" -version = "1.1.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5" dependencies = [ - "itertools 0.13.0", + "itertools 0.14.0", "unicode-segmentation", - "unicode-width", + "unicode-width 0.2.2", ] [[package]] @@ -4523,6 +4720,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/src/rust/lqos_netplan_helper/Cargo.toml b/src/rust/lqos_netplan_helper/Cargo.toml index 257cfc7d..c3106be3 100644 --- a/src/rust/lqos_netplan_helper/Cargo.toml +++ b/src/rust/lqos_netplan_helper/Cargo.toml @@ -15,5 +15,4 @@ clap = { workspace = true } lqos_config = { path = "../lqos_config" } lqos_utils = { path = "../lqos_utils" } serde_yaml = "0.9" -libc = "0.2" tracing = { workspace = true } diff --git a/src/rust/lqos_network_devices/src/combined_catalog.rs b/src/rust/lqos_network_devices/src/combined_catalog.rs index fbe20eaa..df328fa8 100644 --- a/src/rust/lqos_network_devices/src/combined_catalog.rs +++ b/src/rust/lqos_network_devices/src/combined_catalog.rs @@ -53,10 +53,10 @@ impl NetworkDevicesCatalog { } } for (ipv6, prefix) in &circuit.shaped.ipv6 { - if *prefix <= 128 { - if let Ok(net) = IpNetwork::new(*ipv6, *prefix as u8) { - dyn_ip_table.insert(net, idx); - } + if *prefix <= 128 + && let Ok(net) = IpNetwork::new(*ipv6, *prefix as u8) + { + dyn_ip_table.insert(net, idx); } } } diff --git a/src/rust/lqosd/src/node_manager/local_api/flow_explorer.rs b/src/rust/lqosd/src/node_manager/local_api/flow_explorer.rs index e4a2f35c..87444806 100644 --- a/src/rust/lqosd/src/node_manager/local_api/flow_explorer.rs +++ b/src/rust/lqosd/src/node_manager/local_api/flow_explorer.rs @@ -1,4 +1,3 @@ -use crate::throughput_tracker::THROUGHPUT_TRACKER; use crate::throughput_tracker::flow_data::{ AsnCountryListEntry, AsnListEntry, AsnProtocolListEntry, FlowAnalysis, FlowbeeLocalData, RECENT_FLOWS, RttData, diff --git a/src/rust/lqosd/src/node_manager/local_api/throughput_attribution_debug.rs b/src/rust/lqosd/src/node_manager/local_api/throughput_attribution_debug.rs index 88f846bb..e5305d53 100644 --- a/src/rust/lqosd/src/node_manager/local_api/throughput_attribution_debug.rs +++ b/src/rust/lqosd/src/node_manager/local_api/throughput_attribution_debug.rs @@ -147,16 +147,16 @@ fn match_source_for_entry<'a>( device_hash: Option, circuit_hash: Option, ) -> Option<(&'a lqos_config::ShapedDevice, ShapedDeviceMatchSource)> { - if let Some(hash) = device_hash { - if let Some(device) = catalog.device_by_hashes(Some(hash), None) { - return Some((device, ShapedDeviceMatchSource::DeviceHash)); - } + if let Some(hash) = device_hash + && let Some(device) = catalog.device_by_hashes(Some(hash), None) + { + return Some((device, ShapedDeviceMatchSource::DeviceHash)); } - if let Some(hash) = circuit_hash { - if let Some(device) = catalog.device_by_hashes(None, Some(hash)) { - return Some((device, ShapedDeviceMatchSource::CircuitHash)); - } + if let Some(hash) = circuit_hash + && let Some(device) = catalog.device_by_hashes(None, Some(hash)) + { + return Some((device, ShapedDeviceMatchSource::CircuitHash)); } catalog diff --git a/src/rust/lqosd/src/shaped_devices_tracker/mod.rs b/src/rust/lqosd/src/shaped_devices_tracker/mod.rs index 606afa56..08e6a3be 100644 --- a/src/rust/lqosd/src/shaped_devices_tracker/mod.rs +++ b/src/rust/lqosd/src/shaped_devices_tracker/mod.rs @@ -1,13 +1,12 @@ use crate::node_manager::local_api::network_tree_lite::NetworkTreeLiteNode; use crate::treeguard::actor::is_runtime_virtualized_node; -use anyhow::{Context, Result}; +use anyhow::Result; use arc_swap::ArcSwap; use fxhash::{FxHashMap, FxHashSet}; use lqos_bus::{BusResponse, Circuit}; use lqos_config::{ - ConfigShapedDevices, NetworkJsonNode, NetworkJsonTransport, ShapedDevice, - TopologyRuntimeStatusFile, TopologyShapingInputsFile, load_config, - topology_runtime_status_path, topology_shaping_inputs_path, + NetworkJsonNode, NetworkJsonTransport, TopologyRuntimeStatusFile, TopologyShapingInputsFile, + load_config, topology_runtime_status_path, topology_shaping_inputs_path, }; use lqos_queue_tracker::EFFECTIVE_NODE_RATES; use lqos_utils::file_watcher::FileWatcher; @@ -17,13 +16,19 @@ use lqos_utils::units::{DownUpOrder, down_up_retransmit_sample}; use lqos_utils::unix_time::time_since_boot; use once_cell::sync::Lazy; use parking_lot::Mutex; -use std::net::{Ipv4Addr, Ipv6Addr}; use std::path::PathBuf; use std::sync::Arc; use std::sync::atomic::AtomicU64; use std::time::Duration; use tracing::{debug, error, info, warn}; +#[cfg(test)] +use anyhow::Context; +#[cfg(test)] +use lqos_config::{ConfigShapedDevices, ShapedDevice}; +#[cfg(test)] +use std::net::{Ipv4Addr, Ipv6Addr}; + pub mod circuit_live; use crate::throughput_tracker::THROUGHPUT_TRACKER; pub use circuit_live::CircuitLiveSnapshot; @@ -111,12 +116,12 @@ fn active_runtime_shaping_inputs_path(config: &lqos_config::Config) -> Result Result> { - if let Some(active_path) = active_runtime_shaping_inputs_path(config)? { - if active_path.exists() { - let raw = std::fs::read_to_string(&active_path)?; - let shaping_inputs = serde_json::from_str(&raw)?; - return Ok(Some(shaping_inputs)); - } + if let Some(active_path) = active_runtime_shaping_inputs_path(config)? + && active_path.exists() + { + let raw = std::fs::read_to_string(&active_path)?; + let shaping_inputs = serde_json::from_str(&raw)?; + return Ok(Some(shaping_inputs)); } let fallback_path = topology_shaping_inputs_path(config); @@ -128,6 +133,7 @@ fn load_active_runtime_shaping_inputs( Ok(Some(shaping_inputs)) } +#[cfg(test)] fn parse_ipv4_entry(value: &str) -> Option<(Ipv4Addr, u32)> { let trimmed = value.trim(); if trimmed.is_empty() { @@ -141,6 +147,7 @@ fn parse_ipv4_entry(value: &str) -> Option<(Ipv4Addr, u32)> { Some((ip.parse().ok()?, cidr)) } +#[cfg(test)] fn parse_ipv6_entry(value: &str) -> Option<(Ipv6Addr, u32)> { let trimmed = value.trim(); if trimmed.is_empty() { @@ -154,6 +161,7 @@ fn parse_ipv6_entry(value: &str) -> Option<(Ipv6Addr, u32)> { Some((ip.parse().ok()?, cidr)) } +#[cfg(test)] fn parse_ipv4_list(values: &[String]) -> Vec<(Ipv4Addr, u32)> { values .iter() @@ -161,6 +169,7 @@ fn parse_ipv4_list(values: &[String]) -> Vec<(Ipv4Addr, u32)> { .collect() } +#[cfg(test)] fn parse_ipv6_list(values: &[String]) -> Vec<(Ipv6Addr, u32)> { values .iter() @@ -168,6 +177,7 @@ fn parse_ipv6_list(values: &[String]) -> Vec<(Ipv6Addr, u32)> { .collect() } +#[cfg(test)] fn shaped_devices_from_runtime_inputs( shaping_inputs: &TopologyShapingInputsFile, ) -> ConfigShapedDevices { @@ -211,12 +221,14 @@ fn shaped_devices_from_runtime_inputs( } #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[cfg(test)] enum ShapedDevicesLoadSource { RuntimeShapingInputs, TopologyImport, ShapedDevicesCsv, } +#[cfg(test)] fn integration_ingress_enabled(config: &lqos_config::Config) -> bool { config.uisp_integration.enable_uisp || config.splynx_integration.enable_splynx @@ -236,6 +248,7 @@ fn integration_ingress_enabled(config: &lqos_config::Config) -> bool { .is_some_and(|integration| integration.enable_wispgate) } +#[cfg(test)] fn load_ready_runtime_shaping_inputs( config: &lqos_config::Config, ) -> Result> { @@ -256,6 +269,7 @@ fn load_ready_runtime_shaping_inputs( Ok(Some(shaping_inputs)) } +#[cfg(test)] fn load_shaped_devices_from_preferred_source( config: &lqos_config::Config, ) -> Result<(ConfigShapedDevices, ShapedDevicesLoadSource)> { diff --git a/src/rust/lqosd/src/throughput_tracker/mod.rs b/src/rust/lqosd/src/throughput_tracker/mod.rs index e33ace42..39138aec 100644 --- a/src/rust/lqosd/src/throughput_tracker/mod.rs +++ b/src/rust/lqosd/src/throughput_tracker/mod.rs @@ -11,7 +11,6 @@ use self::throughput_entry::ThroughputEntry; use crate::system_stats::SystemStats; use crate::throughput_tracker::flow_data::FlowbeeEffectiveDirection; use crate::{ - lts2_sys::{get_lts_license_status, shared_types::LtsStatus}, stats::TIME_TO_POLL_HOSTS, throughput_tracker::tracking_data::{FlowApplyContext, ThroughputTracker}, }; diff --git a/src/rust/lqtop/Cargo.toml b/src/rust/lqtop/Cargo.toml index 5cb5f240..70e5c6da 100644 --- a/src/rust/lqtop/Cargo.toml +++ b/src/rust/lqtop/Cargo.toml @@ -9,8 +9,8 @@ tokio = { workspace = true } lqos_bus = { path = "../lqos_bus" } lqos_utils = { path = "../lqos_utils" } anyhow = { workspace = true } -ratatui = "0.26.1" -crossterm = "0.27.0" +ratatui = { version = "0.30.0", default-features = false, features = ["crossterm"] } +crossterm = "0.29.0" ctrlc = "3.4.4" sysinfo = { workspace = true } once_cell = { workspace = true} diff --git a/src/rust/lqtop/src/top_level_ui.rs b/src/rust/lqtop/src/top_level_ui.rs index 81d310ff..b6057f73 100644 --- a/src/rust/lqtop/src/top_level_ui.rs +++ b/src/rust/lqtop/src/top_level_ui.rs @@ -105,7 +105,7 @@ impl TopUi { let final_region = constraints.len(); constraints.push(Constraint::Fill(1)); - let main_layout = Layout::new(Direction::Vertical, constraints).split(frame.size()); + let main_layout = Layout::new(Direction::Vertical, constraints).split(frame.area()); // Add Widgets frame.render_widget(help_display(), main_layout[help_region]);