diff --git a/Cargo.lock b/Cargo.lock index 337f735..0806d93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,12 +67,14 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "async-broadcast" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +checksum = "258b52a1aa741b9f09783b2d86cf0aeeb617bbf847f6933340a39644227acbdb" dependencies = [ - "event-listener 2.5.3", + "event-listener 5.0.0", + "event-listener-strategy 0.5.0", "futures-core", + "pin-project-lite", ] [[package]] @@ -88,13 +90,13 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 4.0.3", - "event-listener-strategy", + "event-listener 5.0.0", + "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite", ] @@ -115,14 +117,13 @@ dependencies = [ [[package]] name = "async-fs" -version = "1.6.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +checksum = "bc19683171f287921f2405677dd2ed2549c3b3bda697a563ebc3a121ace2aba1" dependencies = [ - "async-lock 2.8.0", - "autocfg", + "async-lock 3.3.0", "blocking", - "futures-lite 1.13.0", + "futures-lite 2.2.0", ] [[package]] @@ -131,7 +132,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.0", "async-executor", "async-io 2.3.1", "async-lock 3.3.0", @@ -172,7 +173,7 @@ dependencies = [ "futures-io", "futures-lite 2.2.0", "parking", - "polling 3.3.2", + "polling 3.4.0", "rustix 0.38.31", "slab", "tracing", @@ -195,25 +196,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener 4.0.3", - "event-listener-strategy", + "event-listener-strategy 0.4.0", "pin-project-lite", ] [[package]] name = "async-process" -version = "1.8.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" +checksum = "15c1cd5d253ecac3d3cf15e390fd96bd92a13b1d14497d81abf077304794fb04" dependencies = [ - "async-io 1.13.0", - "async-lock 2.8.0", + "async-channel 2.2.0", + "async-io 2.3.1", + "async-lock 3.3.0", "async-signal", "blocking", "cfg-if", - "event-listener 3.1.0", - "futures-lite 1.13.0", + "event-listener 4.0.3", + "futures-lite 2.2.0", "rustix 0.38.31", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -327,7 +329,7 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.0", "async-lock 3.3.0", "async-task", "fastrand 2.0.1", @@ -343,12 +345,6 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "cc" version = "1.0.83" @@ -509,11 +505,17 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + [[package]] name = "enumflags2" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" dependencies = [ "enumflags2_derive", "serde", @@ -521,9 +523,9 @@ dependencies = [ [[package]] name = "enumflags2_derive" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", @@ -554,9 +556,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "3.1.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" dependencies = [ "concurrent-queue", "parking", @@ -565,9 +567,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "4.0.3" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" dependencies = [ "concurrent-queue", "parking", @@ -584,6 +586,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +dependencies = [ + "event-listener 5.0.0", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -756,9 +768,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown", @@ -839,7 +851,7 @@ dependencies = [ "hmac", "libc", "log", - "nix 0.27.1", + "nix", "nom", "once_cell", "serde", @@ -884,15 +896,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.0" @@ -939,18 +942,6 @@ dependencies = [ "zbus", ] -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", -] - [[package]] name = "nix" version = "0.27.1" @@ -960,7 +951,7 @@ dependencies = [ "bitflags 2.4.2", "cfg-if", "libc", - "memoffset 0.9.0", + "memoffset", ] [[package]] @@ -1055,9 +1046,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.3.2" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" +checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" dependencies = [ "cfg-if", "concurrent-queue", @@ -1520,7 +1511,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.0", + "memoffset", "tempfile", "winapi", ] @@ -1849,9 +1840,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] @@ -1868,30 +1859,28 @@ dependencies = [ [[package]] name = "zbus" -version = "3.15.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45d06ae3b0f9ba1fb2671268b975557d8f5a84bb5ec6e43964f87e763d8bca8" +checksum = "d4d98d42da0eb3d36957561d926ccd5fb351b42b529c0f238af91cdb4b9ab93e" dependencies = [ "async-broadcast", "async-executor", "async-fs", - "async-io 1.13.0", - "async-lock 2.8.0", + "async-io 2.3.1", + "async-lock 3.3.0", "async-process", "async-recursion", "async-task", "async-trait", "blocking", - "byteorder", "derivative", "enumflags2", - "event-listener 2.5.3", + "event-listener 5.0.0", "futures-core", "futures-sink", "futures-util", "hex", - "nix 0.26.4", - "once_cell", + "nix", "ordered-stream", "rand", "serde", @@ -1900,7 +1889,7 @@ dependencies = [ "static_assertions", "tracing", "uds_windows", - "winapi", + "windows-sys 0.52.0", "xdg-home", "zbus_macros", "zbus_names", @@ -1909,9 +1898,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.15.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a1ba45ed0ad344b85a2bb5a1fe9830aed23d67812ea39a586e7d0136439c7d" +checksum = "81e30c8a575b1684373b3b745ea5a9155a9f422962515b11f886574b2e08e242" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1923,9 +1912,9 @@ dependencies = [ [[package]] name = "zbus_names" -version = "2.6.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", @@ -1934,13 +1923,12 @@ dependencies = [ [[package]] name = "zvariant" -version = "3.15.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +checksum = "4e09e8be97d44eeab994d752f341e67b3b0d80512a8b315a0671d47232ef1b65" dependencies = [ - "byteorder", + "endi", "enumflags2", - "libc", "serde", "static_assertions", "zvariant_derive", @@ -1948,9 +1936,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.15.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +checksum = "72a5857e2856435331636a9fbb415b09243df4521a267c5bedcd5289b4d5799e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1961,9 +1949,9 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +checksum = "00bedb16a193cc12451873fee2a1bc6550225acece0e36f333e68326c73c8172" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 540fdb1..960692f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3.18", features = [ ], default-features = false } wait-timeout = "0.2.0" walkdir = "2.4.0" -zbus = "3.15.0" +zbus = "4.0.0" [dev-dependencies] duct = "0.13.7" diff --git a/src/broker.rs b/src/broker.rs index 7f873c4..1f154d0 100644 --- a/src/broker.rs +++ b/src/broker.rs @@ -7,9 +7,9 @@ use tracing::{debug, error, info, warn}; use zbus::{Connection, MatchRule, Message, MessageStream}; use crate::{ - dbus_interface::NetworkManagerProxy, launcher::Launcher, link::{LinkDetails, LinkEvent}, + network_dbus::NetworkManagerProxy, script::{EnvVar, ScriptBuilder}, }; @@ -81,7 +81,7 @@ impl Broker { let msg: Arc = match msg { Ok(m) => { debug!("New message: {m}"); - m + m.into() } Err(err) => { error!("{err:#}"); diff --git a/src/lib.rs b/src/lib.rs index 704e940..aa550bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ pub mod args; pub mod broker; -pub mod dbus_interface; pub mod launcher; pub mod link; +pub mod network_dbus; pub mod script; diff --git a/src/link.rs b/src/link.rs index 37a4d84..295ba78 100644 --- a/src/link.rs +++ b/src/link.rs @@ -1,9 +1,9 @@ use anyhow::{bail, Context, Result}; use serde::Deserialize; use tracing::debug; -use zbus::{Message, MessageType}; +use zbus::{names::InterfaceName, Message, MessageType}; -use crate::dbus_interface::NetworkManagerProxy; +use crate::network_dbus::NetworkManagerProxy; #[derive(Deserialize)] pub struct LinkDetails { @@ -49,14 +49,16 @@ impl LinkEvent { bail!("Event message {:?} is not dbus signal", msg.message_type()); } - if &*msg.interface().unwrap() != "org.freedesktop.DBus.Properties" { + if msg.header().interface() + != Some(&InterfaceName::try_from("org.freedesktop.DBus.Properties")?) + { bail!( - "{} is not 'org.freedesktop.DBus.Properties'", - &*msg.interface().unwrap() + "{:?} is not 'org.freedesktop.DBus.Properties'", + msg.header().interface() ); } - let path: String = if let Some(path) = msg.path() { + let path: String = if let Some(path) = msg.header().path() { path.as_str().to_string() } else { bail!("Invalid path: {:?}", &msg); diff --git a/src/dbus_interface.rs b/src/network_dbus.rs similarity index 94% rename from src/dbus_interface.rs rename to src/network_dbus.rs index e49c501..4a90ea5 100644 --- a/src/dbus_interface.rs +++ b/src/network_dbus.rs @@ -1,10 +1,10 @@ -use zbus::dbus_proxy; +use zbus::proxy; /// DBus interface proxy for: `org.freedesktop.network1.Manager` /// /// This code was generated by `zbus-xmlgen` `2.0.1` from DBus introspection data. /// Source: `Interface '/org/freedesktop/network1' from service 'org.freedesktop.network1' on system bus`. -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.network1.Manager", default_service = "org.freedesktop.network1", default_path = "/org/freedesktop/network1"