31 lines
796 B
Go
31 lines
796 B
Go
package checker
|
|
|
|
// computeCoverageView summarises per-transport / per-family reachability
|
|
// from the raw endpoint probes. Pure raw-data aggregation (counts /
|
|
// booleans), no severity or judgment is applied here; callers feed the
|
|
// result back into the report header and (for judgment) into rules.
|
|
func computeCoverageView(data *SIPData) Coverage {
|
|
var cov Coverage
|
|
for _, ep := range data.Endpoints {
|
|
if ep.Reachable {
|
|
if ep.IsIPv6 {
|
|
cov.HasIPv6 = true
|
|
} else {
|
|
cov.HasIPv4 = true
|
|
}
|
|
}
|
|
if !ep.OK() {
|
|
continue
|
|
}
|
|
switch ep.Transport {
|
|
case TransportUDP:
|
|
cov.WorkingUDP = true
|
|
case TransportTCP:
|
|
cov.WorkingTCP = true
|
|
case TransportTLS:
|
|
cov.WorkingTLS = true
|
|
}
|
|
}
|
|
cov.AnyWorking = cov.WorkingUDP || cov.WorkingTCP || cov.WorkingTLS
|
|
return cov
|
|
}
|