Compare commits
1 Commits
bigfix
...
82cc134626
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82cc134626 |
@@ -27,7 +27,7 @@ pub struct P2PClientApp {
|
||||
|
||||
// GUI State
|
||||
status_message: String,
|
||||
known_peers: Vec<String>,
|
||||
known_peers: Vec<(String, bool)>,
|
||||
connect_address_input: String,
|
||||
connected_address: String,
|
||||
connect_name_input: String,
|
||||
@@ -62,7 +62,7 @@ impl P2PClientApp {
|
||||
network_cmd_tx: cmd_tx,
|
||||
network_event_rx: event_rx,
|
||||
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(),
|
||||
connected_address: "".to_string(),
|
||||
loaded_fs,
|
||||
@@ -111,8 +111,8 @@ impl eframe::App for P2PClientApp {
|
||||
todo!();
|
||||
|
||||
self.status_message = format!("✅ Peer connected: {}", addr);
|
||||
if !self.known_peers.contains(&addr) {
|
||||
self.known_peers.push(addr);
|
||||
if !self.known_peers.contains(&(addr, true)) {
|
||||
self.known_peers.push((addr, true));
|
||||
}
|
||||
}
|
||||
NetworkEvent::PeerListUpdated(peers) => {
|
||||
|
||||
@@ -123,7 +123,7 @@ pub enum NetworkEvent {
|
||||
Disconnected(),
|
||||
Error(String),
|
||||
PeerConnected(String),
|
||||
PeerListUpdated(Vec<String>),
|
||||
PeerListUpdated(Vec<(String, bool)>),
|
||||
FileTreeReceived(String, Vec<MerkleNode>), // peer_id, content
|
||||
DataReceived(String, MerkleNode),
|
||||
FileTreeRootReceived(String, String),
|
||||
@@ -292,7 +292,7 @@ pub fn start_p2p_executor(
|
||||
match get_peer_list(ip).await {
|
||||
Ok(body) => match String::from_utf8(body.to_vec()) {
|
||||
Ok(peers_list) => {
|
||||
let mut peers: Vec<String> = Vec::new();
|
||||
let mut peers: Vec<(String, bool)> = Vec::new();
|
||||
let mut current = String::new();
|
||||
for i in peers_list.chars() {
|
||||
if i == '\n' {
|
||||
|
||||
@@ -15,6 +15,8 @@ pub struct HandshakeMessage {
|
||||
pub signature: Vec<u8>,
|
||||
}
|
||||
|
||||
pub struct NatTraversal {}
|
||||
|
||||
impl UDPMessage {
|
||||
pub fn ping(id: u32) -> UDPMessage {
|
||||
UDPMessage {
|
||||
|
||||
16
todo.md
16
todo.md
@@ -1,8 +1,11 @@
|
||||
# Todo :
|
||||
# Todo
|
||||
|
||||
## peer discovery
|
||||
- get rsquest to the uri /peers/
|
||||
|
||||
- get rsquest to the uri /peers/
|
||||
|
||||
## registration with the server
|
||||
|
||||
- generation of the cryptographic key OK
|
||||
- put request to the uri (check if the peer is already connected) OK
|
||||
- udp handshakes OK
|
||||
@@ -10,11 +13,13 @@
|
||||
- get request to the uri /peers/key/addresses OK
|
||||
|
||||
## handshake
|
||||
|
||||
- handshake structure OK
|
||||
- 5min timeout after handshake
|
||||
- matain connection every 4 min
|
||||
|
||||
## data transfer
|
||||
|
||||
- request structure
|
||||
- root/root reply structure
|
||||
- datum/nodatum and datum structures
|
||||
@@ -22,6 +27,13 @@
|
||||
- setting in gui to act as a relay
|
||||
- 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 :
|
||||
|
||||
s'enregistrer avec le serveur OK
|
||||
|
||||
Reference in New Issue
Block a user