mirror of https://github.com/telemt/telemt.git
Extend IPv6 STUN connect error handling to cover more unreachable cases
In addition to ENETUNREACH, also treat HostUnreachable, Unsupported and NetworkDown as non-fatal when probing IPv6 — all indicate the family is unavailable. Guard is limited to IpFamily::V6 so any IPv4 connect failure still propagates as an error.
This commit is contained in:
parent
17b3c612a1
commit
1a07991508
|
|
@ -52,7 +52,13 @@ pub async fn stun_probe_family(stun_addr: &str, family: IpFamily) -> Result<Opti
|
|||
if let Some(addr) = target_addr {
|
||||
match socket.connect(addr).await {
|
||||
Ok(()) => {}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NetworkUnreachable => return Ok(None),
|
||||
Err(e) if family == IpFamily::V6 && matches!(
|
||||
e.kind(),
|
||||
std::io::ErrorKind::NetworkUnreachable
|
||||
| std::io::ErrorKind::HostUnreachable
|
||||
| std::io::ErrorKind::Unsupported
|
||||
| std::io::ErrorKind::NetworkDown
|
||||
) => return Ok(None),
|
||||
Err(e) => return Err(ProxyError::Proxy(format!("STUN connect failed: {e}"))),
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue