diff --git a/src/relay/udprelay/association.rs b/src/relay/udprelay/association.rs index e708a61a..0d1fc6c6 100644 --- a/src/relay/udprelay/association.rs +++ b/src/relay/udprelay/association.rs @@ -203,10 +203,26 @@ impl ProxyAssociation { async fn connect_remote(context: &Context, svr_cfg: &ServerConfig, remote_udp: &UdpSocket) -> io::Result<()> { match svr_cfg.addr() { ServerAddr::SocketAddr(ref remote_addr) => { - remote_udp.connect(remote_addr).await?; + let res = remote_udp.connect(remote_addr).await; + if let Err(ref err) = res { + error!( + "UDP association UdpSocket::connect failed, addr: {}, err: {}", + remote_addr, err + ); + } + res?; } ServerAddr::DomainName(ref dname, port) => { - lookup_then!(context, dname, *port, |addr| { remote_udp.connect(&addr).await })?; + lookup_then!(context, dname, *port, |addr| { + let res = remote_udp.connect(&addr).await; + if let Err(ref err) = res { + error!( + "UDP association UdpSocket::connect failed, addr: {}:{} (resolved: {}), err: {}", + dname, port, addr, err + ); + } + res + })?; } } diff --git a/src/relay/udprelay/redir_local.rs b/src/relay/udprelay/redir_local.rs index 881e79f0..0a9a675a 100644 --- a/src/relay/udprelay/redir_local.rs +++ b/src/relay/udprelay/redir_local.rs @@ -142,7 +142,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> { if let Err(err) = res { error!("failed to create UDP association, {}", err); - return Err(err); } } } diff --git a/src/relay/udprelay/server.rs b/src/relay/udprelay/server.rs index 5f0f6dee..ba550237 100644 --- a/src/relay/udprelay/server.rs +++ b/src/relay/udprelay/server.rs @@ -115,7 +115,6 @@ async fn listen(context: SharedContext, flow_stat: SharedServerFlowStatistic, sv if let Err(err) = res { error!("failed to create UDP association, {}", err); - return Err(err); } } } diff --git a/src/relay/udprelay/socks5_local.rs b/src/relay/udprelay/socks5_local.rs index d09d6172..ebd8b120 100644 --- a/src/relay/udprelay/socks5_local.rs +++ b/src/relay/udprelay/socks5_local.rs @@ -169,7 +169,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> { if let Err(err) = res { error!("failed to create UDP association, {}", err); - return Err(err); } } } diff --git a/src/relay/udprelay/tunnel_local.rs b/src/relay/udprelay/tunnel_local.rs index 214e1d63..f7692bc5 100644 --- a/src/relay/udprelay/tunnel_local.rs +++ b/src/relay/udprelay/tunnel_local.rs @@ -122,7 +122,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> { if let Err(err) = res { error!("failed to create UDP association, {}", err); - return Err(err); } } }