Fix udp and win route (#16)

* robust udp tunnel
* fix windows route add
* use pnet to get index
* windows disable udp reset
This commit is contained in:
Sijie.Sun
2024-02-08 16:27:18 +08:00
committed by GitHub
parent 2c2e41be24
commit 7fc4aecdb9
8 changed files with 285 additions and 11 deletions
+6
View File
@@ -273,6 +273,12 @@ pub(crate) fn setup_sokcet2(
socket2_socket: &socket2::Socket,
bind_addr: &SocketAddr,
) -> Result<(), TunnelError> {
#[cfg(target_os = "windows")]
{
let is_udp = matches!(socket2_socket.r#type()?, socket2::Type::DGRAM);
crate::arch::windows::setup_socket_for_win(socket2_socket, bind_addr, is_udp)?;
}
socket2_socket.set_nonblocking(true)?;
socket2_socket.set_reuse_address(true)?;
socket2_socket.bind(&socket2::SockAddr::from(*bind_addr))?;