2020-04-06 17:55:39 +00:00
|
|
|
use std::net::SocketAddr;
|
2020-04-05 21:33:42 +00:00
|
|
|
use serde::{Serialize, Deserialize};
|
|
|
|
|
2020-04-06 17:55:39 +00:00
|
|
|
use crate::data::*;
|
|
|
|
|
2020-04-05 21:33:42 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub enum Message {
|
|
|
|
Ok,
|
|
|
|
Error(String),
|
|
|
|
|
2020-04-06 17:55:39 +00:00
|
|
|
Ping(PingMessage),
|
2020-04-06 20:27:51 +00:00
|
|
|
PullStatus,
|
|
|
|
PullConfig,
|
|
|
|
AdvertiseNodesUp(Vec<AdvertisedNode>),
|
|
|
|
AdvertiseConfig(NetworkConfig),
|
2020-04-06 17:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PingMessage {
|
|
|
|
pub id: UUID,
|
|
|
|
pub rpc_port: u16,
|
|
|
|
|
2020-04-06 20:27:51 +00:00
|
|
|
pub status_hash: Hash,
|
2020-04-06 17:55:39 +00:00
|
|
|
pub config_version: u64,
|
|
|
|
}
|
|
|
|
|
2020-04-06 20:27:51 +00:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct AdvertisedNode {
|
2020-04-06 17:55:39 +00:00
|
|
|
pub id: UUID,
|
|
|
|
pub addr: SocketAddr,
|
2020-04-05 21:33:42 +00:00
|
|
|
}
|