aboutsummaryrefslogtreecommitdiff
path: root/src/proto.rs
blob: 6cb12598e053134f5c73afd01a84d03d659da7cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::net::SocketAddr;
use serde::{Serialize, Deserialize};

use crate::data::*;

#[derive(Debug, Serialize, Deserialize)]
pub enum Message {
	Ok,
	Error(String),

	Ping(PingMessage),	
	AdvertiseNode(AdvertiseNodeMessage),
}

#[derive(Debug, Serialize, Deserialize)]
pub struct PingMessage {
	pub id: UUID,
	pub rpc_port: u16,

	pub present_hash: Hash,
	pub config_version: u64,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct AdvertiseNodeMessage {
	pub id: UUID,
	pub addr: SocketAddr,
}