feat: added config for master node
This commit is contained in:
parent
1132f8c5fb
commit
b3fb589e36
1 changed files with 10 additions and 3 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue