mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-19 13:29:09 +00:00
fix macOS build
This commit is contained in:
parent
718a623dff
commit
b21d7a6c2c
1 changed files with 1 additions and 1 deletions
|
@ -180,7 +180,7 @@ pub fn parse_udp(udp_mtu: u16, data_len: usize, data: &[u8]) -> Result<(&[u8], u
|
||||||
async fn process_udp(addr: SocketAddr, udp_timeout: u64, tx: Sender<Vec<u8>>, con: &mut UdpRequest) -> Result<()> {
|
async fn process_udp(addr: SocketAddr, udp_timeout: u64, tx: Sender<Vec<u8>>, con: &mut UdpRequest) -> Result<()> {
|
||||||
let std_sock = std::net::UdpSocket::bind("0.0.0.0:0")?;
|
let std_sock = std::net::UdpSocket::bind("0.0.0.0:0")?;
|
||||||
std_sock.set_nonblocking(true)?;
|
std_sock.set_nonblocking(true)?;
|
||||||
#[cfg(unix)]
|
#[cfg(target_os = "linux")]
|
||||||
nix::sys::socket::setsockopt(&std_sock, nix::sys::socket::sockopt::ReuseAddr, &true)?;
|
nix::sys::socket::setsockopt(&std_sock, nix::sys::socket::sockopt::ReuseAddr, &true)?;
|
||||||
let socket = UdpSocket::from_std(std_sock)?;
|
let socket = UdpSocket::from_std(std_sock)?;
|
||||||
socket.send_to(&con.data, &con.server_addr).await?;
|
socket.send_to(&con.data, &con.server_addr).await?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue