feat: init verge config struct

This commit is contained in:
GyDi 2021-12-13 02:29:02 +08:00
parent 4bb9e10946
commit 5b826a3767
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1 @@
pub mod verge;

View File

@ -0,0 +1,41 @@
use serde::{Deserialize, Serialize};
/// Define the verge.yaml's schema
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct VergeConfig {
/// current profile's name
pub current: Option<u32>,
/// profile list
pub profiles: Option<Vec<ProfileData>>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct ProfileData {
/// profile name
pub name: Option<String>,
/// profile file
pub file: Option<String>,
/// current mode
pub mode: Option<String>,
/// source url
pub url: Option<String>,
/// selected infomation
pub selected: Option<Vec<ProfileSelected>>,
/// user info
pub user_info: Option<ProfileUserInfo>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct ProfileSelected {
pub name: Option<String>,
pub now: Option<String>,
}
#[derive(Default, Debug, Clone, Copy, Deserialize, Serialize)]
pub struct ProfileUserInfo {
pub upload: u64,
pub download: u64,
pub total: u64,
pub expire: u64,
}