Implemented P2P network protocol. Refactored project structure.

This commit is contained in:
Revertron
2021-02-05 22:24:28 +01:00
parent 562c004b0d
commit 9e7a1b8834
20 changed files with 524 additions and 101 deletions
+20
View File
@@ -0,0 +1,20 @@
use crate::p2p::State;
pub struct Peer {
addr: String,
state: State,
}
impl Peer {
pub fn new(addr: String, state: State) -> Self {
Peer { addr, state }
}
pub fn get_state(&self) -> &State {
&self.state
}
pub fn set_state(&mut self, state: State) {
self.state = state;
}
}