Skip to content

Commit 118e054

Browse files
committed
ipn/proxies: reachability over all tcp, udp, icmp
1 parent f451f15 commit 118e054

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

intra/ipn/proxy.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,16 @@ func Reaches(p Proxy, hostportOrIPPortCsv string, protos ...string) bool {
311311
return false
312312
}
313313

314-
ok, who, err := core.Race("reach."+pid, getproxytimeout, tests...)
314+
okays, errs := core.All("reach."+pid, getproxytimeout, tests...)
315315

316-
logeif(!ok)("proxy: %s reaches: %v => %v ok? %t; who: %d, err? %v",
317-
pid, hostportOrIPPortCsv, ipps, ok, who, err)
316+
// overall is false if any okays is false, or if all errs are not nil
317+
overall := core.IsAll(errs, func(err error) bool { return err == nil }) &&
318+
core.IsAll(okays, func(ok bool) bool { return ok })
318319

319-
return ok
320+
logeif(overall)("proxy: %s reaches: %v => %v verdict: reachable? %t [oks? %v; errs? %v]",
321+
pid, hostportOrIPPortCsv, ipps, overall, okays, errs)
322+
323+
return overall
320324
}
321325

322326
func AnyAddrForUDP(ipp netip.AddrPort) (proto, anyaddr string) {

0 commit comments

Comments
 (0)