Check urlTest outbound for both networks (TCP/UDP)

This commit is contained in:
ashly-right 2024-03-10 19:28:48 +01:00
parent 91e20525fa
commit 0ade3706a8
No known key found for this signature in database
GPG Key ID: 2C70FC9CFBECF3DE

View File

@ -470,7 +470,8 @@ func (g *URLTestGroup) selectBestLatencyOutbounds() {
if bestTCPLatency == 0 || history.Delay < bestTCPLatency { if bestTCPLatency == 0 || history.Delay < bestTCPLatency {
bestTCPLatency = history.Delay bestTCPLatency = history.Delay
} }
} else if common.Contains(detour.Network(), N.NetworkUDP) { }
if common.Contains(detour.Network(), N.NetworkUDP) {
if bestUDPLatency == 0 || history.Delay < bestUDPLatency { if bestUDPLatency == 0 || history.Delay < bestUDPLatency {
bestUDPLatency = history.Delay bestUDPLatency = history.Delay
} }
@ -485,7 +486,8 @@ func (g *URLTestGroup) selectBestLatencyOutbounds() {
if common.Contains(detour.Network(), N.NetworkTCP) && history.Delay <= bestTCPLatency+g.tolerance { if common.Contains(detour.Network(), N.NetworkTCP) && history.Delay <= bestTCPLatency+g.tolerance {
bestTCPOutbounds = append(bestTCPOutbounds, detour) bestTCPOutbounds = append(bestTCPOutbounds, detour)
} else if common.Contains(detour.Network(), N.NetworkUDP) && history.Delay <= bestUDPLatency+g.tolerance { }
if common.Contains(detour.Network(), N.NetworkUDP) && history.Delay <= bestUDPLatency+g.tolerance {
bestUDPOutbounds = append(bestUDPOutbounds, detour) bestUDPOutbounds = append(bestUDPOutbounds, detour)
} }
} }