This commit is contained in:
asxalex 2024-07-08 18:44:42 +08:00
parent b3b9fcd243
commit ccf74b5781
2 changed files with 4 additions and 1 deletions

View File

@ -316,7 +316,7 @@ async fn send_stun_request(eee: &Node) {
client_id: eee.config.node_uuid.clone(),
network_id: eee.network_id.load(Ordering::Relaxed),
ip: eee.device_config.get_ip(),
nat_type: 0,
nat_type: eee.get_nat_type() as u32,
};
let msg = encode_to_udp_message(Some(req), PacketType::StunRequest as u8).unwrap();
if let Err(e) = send_to_sock(

View File

@ -140,6 +140,9 @@ pub struct Node {
unsafe impl Sync for Node {}
impl Node {
pub fn get_nat_type(&self) -> NatType {
self.nat_type.lock().unwrap().clone()
}
pub async fn start(&self, token: String) {
*self._token.lock().unwrap() = token;
self.start_stop_sender.send(true).await;