diff --git a/rust/Cargo.lock b/rust/Cargo.lock index ef744d5d23..cac42e268f 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -29,12 +29,14 @@ version = "0.1.0" dependencies = [ "agama-lib", "agama-locale-data", - "agama-network", "anyhow", "async-std", "log", + "parking_lot", "simplelog", "systemd-journal-logger", + "thiserror", + "uuid", "zbus", "zbus_macros", ] @@ -79,18 +81,6 @@ dependencies = [ "serde", ] -[[package]] -name = "agama-network" -version = "0.1.0" -dependencies = [ - "agama-lib", - "async-std", - "parking_lot", - "thiserror", - "uuid", - "zbus", -] - [[package]] name = "ahash" version = "0.8.3" @@ -1965,9 +1955,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ "getrandom", "serde", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 636ad6328e..0015478bee 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -4,6 +4,5 @@ members = [ "agama-dbus-server", "agama-derive", "agama-lib", - "agama-locale-data", - "agama-network" -] + "agama-locale-data" +] \ No newline at end of file diff --git a/rust/agama-dbus-server/Cargo.toml b/rust/agama-dbus-server/Cargo.toml index 3604bb06d9..dff9b917f1 100644 --- a/rust/agama-dbus-server/Cargo.toml +++ b/rust/agama-dbus-server/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [dependencies] anyhow = "1.0" agama-locale-data = { path="../agama-locale-data" } -agama-network = { path="../agama-network" } agama-lib = { path="../agama-lib" } log = "0.4" simplelog = "0.12.1" @@ -16,3 +15,6 @@ systemd-journal-logger = "1.0" zbus = "3.7.0" zbus_macros = "3.7.0" async-std = { version = "1.12.0", features = ["attributes"]} +uuid = { version = "1.3.4", features = ["v4"] } +parking_lot = "0.12.1" +thiserror = "1.0.40" diff --git a/rust/agama-dbus-server/src/main.rs b/rust/agama-dbus-server/src/main.rs index f5762adfe2..eb0348a404 100644 --- a/rust/agama-dbus-server/src/main.rs +++ b/rust/agama-dbus-server/src/main.rs @@ -1,9 +1,10 @@ pub mod error; pub mod locale; +pub mod network; pub mod questions; -use agama_network::NetworkService; use log::LevelFilter; +use network::NetworkService; use std::future::pending; const ADDRESS: &str = "unix:path=/run/agama/bus"; diff --git a/rust/agama-network/src/lib.rs b/rust/agama-dbus-server/src/network.rs similarity index 100% rename from rust/agama-network/src/lib.rs rename to rust/agama-dbus-server/src/network.rs diff --git a/rust/agama-network/src/action.rs b/rust/agama-dbus-server/src/network/action.rs similarity index 91% rename from rust/agama-network/src/action.rs rename to rust/agama-dbus-server/src/network/action.rs index 7779bebc00..8c7b93945d 100644 --- a/rust/agama-network/src/action.rs +++ b/rust/agama-dbus-server/src/network/action.rs @@ -1,4 +1,4 @@ -use crate::model::{Connection, DeviceType}; +use crate::network::model::{Connection, DeviceType}; use uuid::Uuid; /// Networking actions, like adding, updating or removing connections. diff --git a/rust/agama-network/src/adapter.rs b/rust/agama-dbus-server/src/network/adapter.rs similarity index 87% rename from rust/agama-network/src/adapter.rs rename to rust/agama-dbus-server/src/network/adapter.rs index f3040d06e9..b5d24c4250 100644 --- a/rust/agama-network/src/adapter.rs +++ b/rust/agama-dbus-server/src/network/adapter.rs @@ -1,4 +1,4 @@ -use crate::NetworkState; +use crate::network::NetworkState; use std::error::Error; /// A trait for the ability to read/write from/to a network service diff --git a/rust/agama-network/src/dbus.rs b/rust/agama-dbus-server/src/network/dbus.rs similarity index 100% rename from rust/agama-network/src/dbus.rs rename to rust/agama-dbus-server/src/network/dbus.rs diff --git a/rust/agama-network/src/dbus/interfaces.rs b/rust/agama-dbus-server/src/network/dbus/interfaces.rs similarity index 99% rename from rust/agama-network/src/dbus/interfaces.rs rename to rust/agama-dbus-server/src/network/dbus/interfaces.rs index a209c5ea61..ff91881da1 100644 --- a/rust/agama-network/src/dbus/interfaces.rs +++ b/rust/agama-dbus-server/src/network/dbus/interfaces.rs @@ -3,7 +3,7 @@ //! This module contains the set of D-Bus interfaces that are exposed by [D-Bus network //! service](crate::NetworkService). use super::ObjectsRegistry; -use crate::{ +use crate::network::{ action::Action, error::NetworkStateError, model::{Connection as NetworkConnection, Device as NetworkDevice, WirelessConnection}, diff --git a/rust/agama-network/src/dbus/service.rs b/rust/agama-dbus-server/src/network/dbus/service.rs similarity index 97% rename from rust/agama-network/src/dbus/service.rs rename to rust/agama-dbus-server/src/network/dbus/service.rs index 5ffe35d8fe..436407390d 100644 --- a/rust/agama-network/src/dbus/service.rs +++ b/rust/agama-dbus-server/src/network/dbus/service.rs @@ -1,7 +1,7 @@ //! Network D-Bus service. //! //! This module defines a D-Bus service which exposes Agama's network configuration. -use crate::NetworkSystem; +use crate::network::NetworkSystem; use agama_lib::connection_to; use std::{error::Error, thread}; diff --git a/rust/agama-network/src/dbus/tree.rs b/rust/agama-dbus-server/src/network/dbus/tree.rs similarity index 99% rename from rust/agama-network/src/dbus/tree.rs rename to rust/agama-dbus-server/src/network/dbus/tree.rs index 9dbea939ea..71e740e7ea 100644 --- a/rust/agama-network/src/dbus/tree.rs +++ b/rust/agama-dbus-server/src/network/dbus/tree.rs @@ -2,7 +2,7 @@ use agama_lib::error::ServiceError; use parking_lot::Mutex; use uuid::Uuid; -use crate::{action::Action, dbus::interfaces, model::*}; +use crate::network::{action::Action, dbus::interfaces, model::*}; use std::collections::HashMap; use std::sync::mpsc::Sender; use std::sync::Arc; diff --git a/rust/agama-network/src/error.rs b/rust/agama-dbus-server/src/network/error.rs similarity index 100% rename from rust/agama-network/src/error.rs rename to rust/agama-dbus-server/src/network/error.rs diff --git a/rust/agama-network/src/model.rs b/rust/agama-dbus-server/src/network/model.rs similarity index 99% rename from rust/agama-network/src/model.rs rename to rust/agama-dbus-server/src/network/model.rs index ecc1f53aa2..186d990274 100644 --- a/rust/agama-network/src/model.rs +++ b/rust/agama-dbus-server/src/network/model.rs @@ -4,7 +4,7 @@ //! agnostic from the real network service (e.g., NetworkManager). use uuid::Uuid; -use crate::error::NetworkStateError; +use crate::network::error::NetworkStateError; use agama_lib::network::types::SSID; use std::{fmt, net::Ipv4Addr, str}; @@ -91,7 +91,7 @@ mod tests { use uuid::Uuid; use super::{BaseConnection, Connection, EthernetConnection, NetworkState}; - use crate::error::NetworkStateError; + use crate::network::error::NetworkStateError; #[test] fn test_add_connection() { diff --git a/rust/agama-network/src/nm.rs b/rust/agama-dbus-server/src/network/nm.rs similarity index 100% rename from rust/agama-network/src/nm.rs rename to rust/agama-dbus-server/src/network/nm.rs diff --git a/rust/agama-network/src/nm/adapter.rs b/rust/agama-dbus-server/src/network/nm/adapter.rs similarity index 98% rename from rust/agama-network/src/nm/adapter.rs rename to rust/agama-dbus-server/src/network/nm/adapter.rs index 508442e6aa..2f7c8654e7 100644 --- a/rust/agama-network/src/nm/adapter.rs +++ b/rust/agama-dbus-server/src/network/nm/adapter.rs @@ -1,4 +1,4 @@ -use crate::{ +use crate::network::{ model::{Connection, NetworkState}, nm::NetworkManagerClient, Adapter, diff --git a/rust/agama-network/src/nm/client.rs b/rust/agama-dbus-server/src/network/nm/client.rs similarity index 98% rename from rust/agama-network/src/nm/client.rs rename to rust/agama-dbus-server/src/network/nm/client.rs index cb366e167e..3f5926f0f7 100644 --- a/rust/agama-network/src/nm/client.rs +++ b/rust/agama-dbus-server/src/network/nm/client.rs @@ -2,7 +2,7 @@ use super::dbus::{connection_from_dbus, connection_to_dbus, merge_dbus_connections}; use super::model::NmDeviceType; use super::proxies::{ConnectionProxy, DeviceProxy, NetworkManagerProxy, SettingsProxy}; -use crate::model::{Connection, Device}; +use crate::network::model::{Connection, Device}; use agama_lib::error::ServiceError; use uuid::Uuid; use zbus; diff --git a/rust/agama-network/src/nm/dbus.rs b/rust/agama-dbus-server/src/network/nm/dbus.rs similarity index 99% rename from rust/agama-network/src/nm/dbus.rs rename to rust/agama-dbus-server/src/network/nm/dbus.rs index d398ee8a50..a0ef6458b3 100644 --- a/rust/agama-network/src/nm/dbus.rs +++ b/rust/agama-dbus-server/src/network/nm/dbus.rs @@ -3,7 +3,7 @@ //! Working with hash maps coming from D-Bus is rather tedious and it is even worse when working //! with nested hash maps (see [NestedHash] and [OwnedNestedHash]). use super::model::*; -use crate::model::*; +use crate::network::model::*; use agama_lib::{ dbus::{NestedHash, OwnedNestedHash}, network::types::SSID, @@ -246,7 +246,7 @@ mod test { connection_from_dbus, connection_to_dbus, merge_dbus_connections, NestedHash, OwnedNestedHash, }; - use crate::{model::*, nm::dbus::ETHERNET_KEY}; + use crate::network::{model::*, nm::dbus::ETHERNET_KEY}; use agama_lib::network::types::SSID; use std::{collections::HashMap, net::Ipv4Addr}; use uuid::Uuid; diff --git a/rust/agama-network/src/nm/error.rs b/rust/agama-dbus-server/src/network/nm/error.rs similarity index 92% rename from rust/agama-network/src/nm/error.rs rename to rust/agama-dbus-server/src/network/nm/error.rs index 0d9627ee91..35ca5f75c1 100644 --- a/rust/agama-network/src/nm/error.rs +++ b/rust/agama-dbus-server/src/network/nm/error.rs @@ -1,5 +1,5 @@ //! NetworkManager error types -use crate::error::NetworkStateError; +use crate::network::error::NetworkStateError; use thiserror::Error; #[derive(Error, Debug)] diff --git a/rust/agama-network/src/nm/model.rs b/rust/agama-dbus-server/src/network/nm/model.rs similarity index 99% rename from rust/agama-network/src/nm/model.rs rename to rust/agama-dbus-server/src/network/nm/model.rs index 0b6fb659dd..2b7378d851 100644 --- a/rust/agama-network/src/nm/model.rs +++ b/rust/agama-dbus-server/src/network/nm/model.rs @@ -6,7 +6,7 @@ /// /// Using the newtype pattern around an String is enough. For proper support, we might replace this /// struct with an enum. -use crate::{ +use crate::network::{ model::{DeviceType, IpMethod, SecurityProtocol, WirelessMode}, nm::error::NmError, }; diff --git a/rust/agama-network/src/nm/proxies.rs b/rust/agama-dbus-server/src/network/nm/proxies.rs similarity index 100% rename from rust/agama-network/src/nm/proxies.rs rename to rust/agama-dbus-server/src/network/nm/proxies.rs diff --git a/rust/agama-network/src/system.rs b/rust/agama-dbus-server/src/network/system.rs similarity index 96% rename from rust/agama-network/src/system.rs rename to rust/agama-dbus-server/src/network/system.rs index c92eca4457..9439f14a8f 100644 --- a/rust/agama-network/src/system.rs +++ b/rust/agama-dbus-server/src/network/system.rs @@ -1,5 +1,6 @@ -use crate::dbus::Tree; -use crate::{model::Connection, nm::NetworkManagerAdapter, Action, Adapter, NetworkState}; +use crate::network::{ + dbus::Tree, model::Connection, nm::NetworkManagerAdapter, Action, Adapter, NetworkState +}; use agama_lib::error::ServiceError; use std::error::Error; use std::sync::mpsc::{channel, Receiver, Sender}; diff --git a/rust/agama-network/Cargo.toml b/rust/agama-network/Cargo.toml deleted file mode 100644 index 3aad2f4ce6..0000000000 --- a/rust/agama-network/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "agama-network" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -zbus = "3.12.0" -agama-lib = { path="../agama-lib" } -async-std = { version = "1.12.0", features = ["attributes"] } -thiserror = "1.0.40" -uuid = { version = "1.3.3", features = ["v4"] } -parking_lot = "0.12.1"