From dc9ad9028b58597cee87eef2f6647e7149cfc278 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Oct 2025 02:01:04 +0800 Subject: Add service module with macros and action framework - Create new vcs_service crate for handling service actions - Add vcs_service_macros crate for procedural macros - Add vcs_test module with action framework integration - Implement Action and ActionPool traits for service operations --- crates/vcs/vcs_test/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 crates/vcs/vcs_test/lib.rs (limited to 'crates/vcs') diff --git a/crates/vcs/vcs_test/lib.rs b/crates/vcs/vcs_test/lib.rs new file mode 100644 index 0000000..5b65941 --- /dev/null +++ b/crates/vcs/vcs_test/lib.rs @@ -0,0 +1,11 @@ +use vcs_service::{action::Action, action_pool::ActionPool}; + +use crate::actions::test::FindMemberInServer; + +pub mod constants; +pub mod current; + +#[allow(dead_code)] +pub mod data; + +pub mod actions; -- cgit From c6a685b4a2c7177039401deb6ac419202879ec26 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Oct 2025 02:01:12 +0800 Subject: Update dependencies and workspace configuration - Add vcs_service to workspace members in Cargo.toml - Update Cargo.lock with new vcs_service dependencies - Add vcs_service dependency to vcs crate --- crates/vcs/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/vcs') diff --git a/crates/vcs/Cargo.toml b/crates/vcs/Cargo.toml index ec1fb14..98ab6c9 100644 --- a/crates/vcs/Cargo.toml +++ b/crates/vcs/Cargo.toml @@ -7,6 +7,7 @@ version.workspace = true tcp_connection = { path = "../utils/tcp_connection" } cfg_file = { path = "../utils/cfg_file", features = ["default"] } string_proc = { path = "../utils/string_proc" } +vcs_service = { path = "../service" } # Identity uuid = { version = "1.18.1", features = ["v4", "serde"] } -- cgit From a58881c947cc74ae9950eda8d8ea36f08c4c3e6f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Oct 2025 02:01:19 +0800 Subject: Enhance VaultConfig with server configuration - Add VaultServerConfig struct with server settings - Include local bind address, port, LAN discovery, and auth strength - Add default server configuration with localhost binding and advanced auth - Update constants usage for port configuration --- crates/vcs/src/data/vault/config.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'crates/vcs') diff --git a/crates/vcs/src/data/vault/config.rs b/crates/vcs/src/data/vault/config.rs index 40ba09f..1cfc8ef 100644 --- a/crates/vcs/src/data/vault/config.rs +++ b/crates/vcs/src/data/vault/config.rs @@ -1,7 +1,9 @@ +use std::net::{IpAddr, Ipv4Addr}; + use cfg_file::ConfigFile; use serde::{Deserialize, Serialize}; -use crate::constants::SERVER_FILE_VAULT; +use crate::constants::{PORT, SERVER_FILE_VAULT}; use crate::data::member::{Member, MemberId}; #[derive(Serialize, Deserialize, ConfigFile)] @@ -12,6 +14,29 @@ pub struct VaultConfig { /// Vault admin id, a list of member id representing administrator identities vault_admin_list: Vec, + + /// Vault server configuration, which will be loaded when connecting to the server + server_config: VaultServerConfig, +} + +#[derive(Serialize, Deserialize)] +pub struct VaultServerConfig { + /// Local IP address to bind to when the server starts + local_bind: IpAddr, + + /// TCP port to bind to when the server starts + port: u16, + + /// Whether to enable LAN discovery, allowing members on the same LAN to more easily find the upstream server + lan_discovery: bool, + + /// Authentication strength level + /// 0: Weakest - Anyone can claim any identity, fastest speed + /// 1: Basic - Any device can claim any registered identity, slightly faster + /// 2: Advanced - Uses asymmetric encryption, multiple devices can use key authentication to log in simultaneously, slightly slower + /// 3: Secure - Uses asymmetric encryption, only one device can use key for authentication at a time, much slower + /// Default is "Advanced", if using a lower security policy, ensure your server is only accessible by trusted devices + auth_strength: u8, } impl Default for VaultConfig { @@ -19,6 +44,12 @@ impl Default for VaultConfig { Self { vault_name: "JustEnoughVault".to_string(), vault_admin_list: Vec::new(), + server_config: VaultServerConfig { + local_bind: IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), + port: PORT, + lan_discovery: false, + auth_strength: 2, + }, } } } -- cgit From fab046cf951449b94a4c7bef417093e076303218 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Oct 2025 02:01:29 +0800 Subject: Remove old service module and refactor lib structure - Delete legacy service.rs and its submodules - Remove service module from lib.rs exports - Clean up unused service-related code --- crates/vcs/src/lib.rs | 2 -- crates/vcs/src/service.rs | 2 -- crates/vcs/src/service/server_entry.rs | 0 crates/vcs/src/service/standard_handle.rs | 1 - 4 files changed, 5 deletions(-) delete mode 100644 crates/vcs/src/service.rs delete mode 100644 crates/vcs/src/service/server_entry.rs delete mode 100644 crates/vcs/src/service/standard_handle.rs (limited to 'crates/vcs') diff --git a/crates/vcs/src/lib.rs b/crates/vcs/src/lib.rs index 9a84b4d..1b41391 100644 --- a/crates/vcs/src/lib.rs +++ b/crates/vcs/src/lib.rs @@ -3,5 +3,3 @@ pub mod current; #[allow(dead_code)] pub mod data; - -pub mod service; diff --git a/crates/vcs/src/service.rs b/crates/vcs/src/service.rs deleted file mode 100644 index 53365b8..0000000 --- a/crates/vcs/src/service.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod server_entry; -pub mod standard_handle; diff --git a/crates/vcs/src/service/server_entry.rs b/crates/vcs/src/service/server_entry.rs deleted file mode 100644 index e69de29..0000000 diff --git a/crates/vcs/src/service/standard_handle.rs b/crates/vcs/src/service/standard_handle.rs deleted file mode 100644 index 8b13789..0000000 --- a/crates/vcs/src/service/standard_handle.rs +++ /dev/null @@ -1 +0,0 @@ - -- cgit