mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-13 00:02:41 +10:00
chore(p2p): Starting p2p progress
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
@ -3,6 +3,7 @@ mod db;
|
||||
mod downloads;
|
||||
mod library;
|
||||
mod remote;
|
||||
mod p2p;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
|
||||
27
src-tauri/src/p2p/discovery.rs
Normal file
27
src-tauri/src/p2p/discovery.rs
Normal 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
1
src-tauri/src/p2p/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod discovery;
|
||||
Reference in New Issue
Block a user