chore(p2p): Starting p2p progress

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-06 16:40:19 +11:00
parent ae68506268
commit f6f8186d5a
3 changed files with 29 additions and 0 deletions
+1
View File
@@ -3,6 +3,7 @@ mod db;
mod downloads;
mod library;
mod remote;
mod p2p;
#[cfg(test)]
mod tests;
+27
View File
@@ -0,0 +1,27 @@
use serde::{Deserialize, Serialize};
use url::Url;
#[derive(Serialize, Deserialize, Debug)]
pub struct P2PManager {
peers: Vec<Peer>
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Peer {
endpoints: Vec<Url>,
current_endpoint: usize,
// TODO: Implement Wireguard tunnels
}
impl Peer {
pub fn get_current_endpoint(&self) -> Url {
return self.endpoints[self.current_endpoint].clone();
}
pub fn connect(&mut self, ) {
todo!()
}
pub fn disconnect(&mut self) {
todo!()
}
}
+1
View File
@@ -0,0 +1 @@
pub mod discovery;