diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-06 02:03:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-06 02:03:23 +0800 |
| commit | c053e24c62890003aba84191e332211647f96eae (patch) | |
| tree | 3d2e506b32ca7cb32729f04a91304803e8ed3326 /crates/vcs/src/data/vault | |
| parent | 50b801a11e1c3bb3012ac189197b7e84663ba902 (diff) | |
| parent | bbb2b506e8f5ea7aae2b1365a75db9274f860f81 (diff) | |
Merge pull request #15 from JustEnoughVCS/jvcs_dev
Jvcs dev
Diffstat (limited to 'crates/vcs/src/data/vault')
| -rw-r--r-- | crates/vcs/src/data/vault/config.rs | 33 |
1 files changed, 32 insertions, 1 deletions
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<MemberId>, + + /// 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, + }, } } } |
