Compare commits
1 Commits
download_p
...
82cc134626
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82cc134626 |
@@ -27,7 +27,7 @@ pub struct P2PClientApp {
|
|||||||
|
|
||||||
// GUI State
|
// GUI State
|
||||||
status_message: String,
|
status_message: String,
|
||||||
known_peers: Vec<String>,
|
known_peers: Vec<(String, bool)>,
|
||||||
connect_address_input: String,
|
connect_address_input: String,
|
||||||
connected_address: String,
|
connected_address: String,
|
||||||
connect_name_input: String,
|
connect_name_input: String,
|
||||||
@@ -62,7 +62,7 @@ impl P2PClientApp {
|
|||||||
network_cmd_tx: cmd_tx,
|
network_cmd_tx: cmd_tx,
|
||||||
network_event_rx: event_rx,
|
network_event_rx: event_rx,
|
||||||
status_message: "Client Initialized. Awaiting network status...".to_string(),
|
status_message: "Client Initialized. Awaiting network status...".to_string(),
|
||||||
known_peers: vec!["bob".to_string()],
|
known_peers: vec![("bob".to_string(), true)],
|
||||||
connect_address_input: "https://jch.irif.fr:8443".to_string(),
|
connect_address_input: "https://jch.irif.fr:8443".to_string(),
|
||||||
connected_address: "".to_string(),
|
connected_address: "".to_string(),
|
||||||
loaded_fs,
|
loaded_fs,
|
||||||
@@ -111,8 +111,8 @@ impl eframe::App for P2PClientApp {
|
|||||||
todo!();
|
todo!();
|
||||||
|
|
||||||
self.status_message = format!("✅ Peer connected: {}", addr);
|
self.status_message = format!("✅ Peer connected: {}", addr);
|
||||||
if !self.known_peers.contains(&addr) {
|
if !self.known_peers.contains(&(addr, true)) {
|
||||||
self.known_peers.push(addr);
|
self.known_peers.push((addr, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NetworkEvent::PeerListUpdated(peers) => {
|
NetworkEvent::PeerListUpdated(peers) => {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ pub enum NetworkEvent {
|
|||||||
Disconnected(),
|
Disconnected(),
|
||||||
Error(String),
|
Error(String),
|
||||||
PeerConnected(String),
|
PeerConnected(String),
|
||||||
PeerListUpdated(Vec<String>),
|
PeerListUpdated(Vec<(String, bool)>),
|
||||||
FileTreeReceived(String, Vec<MerkleNode>), // peer_id, content
|
FileTreeReceived(String, Vec<MerkleNode>), // peer_id, content
|
||||||
DataReceived(String, MerkleNode),
|
DataReceived(String, MerkleNode),
|
||||||
FileTreeRootReceived(String, String),
|
FileTreeRootReceived(String, String),
|
||||||
@@ -292,7 +292,7 @@ pub fn start_p2p_executor(
|
|||||||
match get_peer_list(ip).await {
|
match get_peer_list(ip).await {
|
||||||
Ok(body) => match String::from_utf8(body.to_vec()) {
|
Ok(body) => match String::from_utf8(body.to_vec()) {
|
||||||
Ok(peers_list) => {
|
Ok(peers_list) => {
|
||||||
let mut peers: Vec<String> = Vec::new();
|
let mut peers: Vec<(String, bool)> = Vec::new();
|
||||||
let mut current = String::new();
|
let mut current = String::new();
|
||||||
for i in peers_list.chars() {
|
for i in peers_list.chars() {
|
||||||
if i == '\n' {
|
if i == '\n' {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ pub struct HandshakeMessage {
|
|||||||
pub signature: Vec<u8>,
|
pub signature: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct NatTraversal {}
|
||||||
|
|
||||||
impl UDPMessage {
|
impl UDPMessage {
|
||||||
pub fn ping(id: u32) -> UDPMessage {
|
pub fn ping(id: u32) -> UDPMessage {
|
||||||
UDPMessage {
|
UDPMessage {
|
||||||
|
|||||||
16
todo.md
16
todo.md
@@ -1,8 +1,11 @@
|
|||||||
# Todo :
|
# Todo
|
||||||
|
|
||||||
## peer discovery
|
## peer discovery
|
||||||
- get rsquest to the uri /peers/
|
|
||||||
|
- get rsquest to the uri /peers/
|
||||||
|
|
||||||
## registration with the server
|
## registration with the server
|
||||||
|
|
||||||
- generation of the cryptographic key OK
|
- generation of the cryptographic key OK
|
||||||
- put request to the uri (check if the peer is already connected) OK
|
- put request to the uri (check if the peer is already connected) OK
|
||||||
- udp handshakes OK
|
- udp handshakes OK
|
||||||
@@ -10,11 +13,13 @@
|
|||||||
- get request to the uri /peers/key/addresses OK
|
- get request to the uri /peers/key/addresses OK
|
||||||
|
|
||||||
## handshake
|
## handshake
|
||||||
|
|
||||||
- handshake structure OK
|
- handshake structure OK
|
||||||
- 5min timeout after handshake
|
- 5min timeout after handshake
|
||||||
- matain connection every 4 min
|
- matain connection every 4 min
|
||||||
|
|
||||||
## data transfer
|
## data transfer
|
||||||
|
|
||||||
- request structure
|
- request structure
|
||||||
- root/root reply structure
|
- root/root reply structure
|
||||||
- datum/nodatum and datum structures
|
- datum/nodatum and datum structures
|
||||||
@@ -22,6 +27,13 @@
|
|||||||
- setting in gui to act as a relay
|
- setting in gui to act as a relay
|
||||||
- chunk, directory, big, bigdirectory structures
|
- chunk, directory, big, bigdirectory structures
|
||||||
|
|
||||||
|
## nat traversal
|
||||||
|
|
||||||
|
- make hello and helloreply messages set the first extension bit to announce that peer is available for nat traversal
|
||||||
|
- implement actual nat traversal requests
|
||||||
|
- implement nat traversal :
|
||||||
|
- if hello/helloreply doesnt work with a peer, find a peer that supports nat traversal (server in priority) then begin protocol
|
||||||
|
|
||||||
fonctionnalités :
|
fonctionnalités :
|
||||||
|
|
||||||
s'enregistrer avec le serveur OK
|
s'enregistrer avec le serveur OK
|
||||||
|
|||||||
Reference in New Issue
Block a user