summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-09-04 01:57:22 +0800
committerKeuin <[email protected]>2023-09-04 02:03:15 +0800
commit143014a91e695106d8383ed173c482b3b4519663 (patch)
tree717d8d34ce9a5857b0293f7fcf7ea9ba13199da7 /src/config.rs
initial versionv0.1.0
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..7eee270
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,30 @@
+use serde_derive::{Deserialize, Serialize};
+
+#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct Server {
+ pub listen: String,
+}
+
+#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct Service {
+ pub name: String,
+ pub addr: String, // host:port
+}
+
+#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct Client {
+ pub addr: String,
+}
+
+#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct Root {
+ pub server: Option<Server>,
+ pub client: Option<Client>,
+ pub service: Vec<Service>,
+ #[serde(default = "default_true")]
+ pub allow_help: bool,
+}
+
+fn default_true() -> bool {
+ true
+}