From b3fb589e3605a31e08ced7c2cae3fe89aa7c63ce Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 15 Oct 2023 18:06:28 +0200 Subject: [PATCH] feat: added config for master node --- domo_node/src/config/node.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/domo_node/src/config/node.rs b/domo_node/src/config/node.rs index 618350f..5ee5b3e 100644 --- a/domo_node/src/config/node.rs +++ b/domo_node/src/config/node.rs @@ -1,10 +1,14 @@ use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; +use domo_proto::packet::identifier::Identifier; #[derive(Debug, Serialize, Deserialize, Clone)] pub enum NodeType { #[serde(rename = "master")] - Master, + Master { + bind: String, + identifier: String + }, #[serde(rename = "relay")] Relay { master_address: String @@ -18,7 +22,7 @@ pub enum NodeType { impl Display for NodeType { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - NodeType::Master => write!(f, "master"), + NodeType::Master { .. } => write!(f, "master"), NodeType::Relay { .. } => write!(f, "relay"), NodeType::Subnet { .. } => write!(f, "subnet"), } @@ -27,7 +31,10 @@ impl Display for NodeType { impl Default for NodeType { fn default() -> Self { - Self::Master + Self::Master { + bind: String::from("0.0.0.0:4480"), + identifier: hex::encode(Identifier::random().to_string()) + } } }