From dc9bf9cc6b0019aef7c4d35030013c9a4f2b9d55 Mon Sep 17 00:00:00 2001 From: asxalex Date: Tue, 16 Jul 2024 15:34:42 +0800 Subject: [PATCH] changed 1969 to 1970 in multicast port --- src/config/mod.rs | 2 +- src/utils/socks.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 8e90d01..f093ce4 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -2,7 +2,7 @@ pub const REGISTER_INTERVAL: u8 = 20; pub const REGISTER_SUPER_INTERVAL: u16 = 20; pub const MULITCAST_V4: [u8; 4] = [224, 0, 0, 69]; -pub const MULTICAST_PORT: u16 = 1969; +pub const MULTICAST_PORT: u16 = 1970; // pub const SUPER_ATTEMPTS_DEFAULT: u8 = 3; diff --git a/src/utils/socks.rs b/src/utils/socks.rs index 702a4e0..c7a1d7b 100644 --- a/src/utils/socks.rs +++ b/src/utils/socks.rs @@ -47,12 +47,15 @@ impl Socket { true => "0.0.0.0", false => "127.0.0.1", }; - let udp = UdpSocket::bind(format!("{}:{}", addr, port)).await?; + let addr = format!("{}:{}", addr, port); + let udp = UdpSocket::bind(&addr).await?; if join_multicast { if let Err(e) = udp.join_multicast_v4(Ipv4Addr::new(224, 0, 0, 69), Ipv4Addr::new(0, 0, 0, 0)) { error!("failed to join multicast: {}", e.to_string()); + } else { + println!("{} joined multicast ok", addr); } } if tos != 0 { @@ -103,6 +106,7 @@ pub async fn send_to_sock( AF_INET => { // sockv4 let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::from(sock.v4)), sock.port); + println!("udp sock v4 send to {}", addr); eee.udp_sock_v4.send_to(content, addr).await?; return Ok(()); }