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 046ba643e2
commit 97bb1fac68
3 changed files with 29 additions and 0 deletions

View File

@ -3,6 +3,7 @@ mod db;
mod downloads; mod downloads;
mod library; mod library;
mod remote; mod remote;
mod p2p;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

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
src-tauri/src/p2p/mod.rs Normal file
View File

@ -0,0 +1 @@
pub mod discovery;