feat: 初步增加 Windows 支持

This commit is contained in:
mofeng-git
2026-05-18 22:43:28 +08:00
parent 0b9d94f53f
commit 935fa823f2
163 changed files with 11419 additions and 7581 deletions

14
src/utils/net_disabled.rs Normal file
View File

@@ -0,0 +1,14 @@
use std::io;
use std::net::{SocketAddr, TcpListener, UdpSocket};
pub fn bind_tcp_listener(addr: SocketAddr) -> io::Result<TcpListener> {
let listener = TcpListener::bind(addr)?;
listener.set_nonblocking(true)?;
Ok(listener)
}
pub fn bind_udp_socket(addr: SocketAddr) -> io::Result<UdpSocket> {
let socket = UdpSocket::bind(addr)?;
socket.set_nonblocking(true)?;
Ok(socket)
}