feat: implement download peer

This commit is contained in:
Michel de Graaf
2025-07-31 20:06:41 +02:00
parent 956cb824bd
commit 9553537bc6
9 changed files with 590 additions and 7 deletions
+15 -2
View File
@@ -1,4 +1,4 @@
use crate::{message::Message, types::Transfer, utils::md5};
use crate::{message::Message, peer::ConnectionType, types::Transfer, utils::md5};
pub struct MessageFactory;
impl MessageFactory {
@@ -91,7 +91,20 @@ impl MessageFactory {
}
pub fn build_pierce_firewall_message(token: u32) -> Message {
Message::new()
.write_int32(0) // PierceFirewall message code
.write_int32(0) // PierceFirewall message code
.write_int32(token)
.clone()
}
#[allow(dead_code)]
pub fn build_peer_init_message(
own_username: &str,
connection_type: ConnectionType,
token: u32,
) -> Message {
Message::new()
.write_string(own_username)
.write_string(&connection_type.to_string())
.write_int32(token)
.clone()
}