RankIPs sorts reachable IPs by RTT ascending. Unreachable are dropped.
(in []IPResult)
| 79 | |
| 80 | // RankIPs sorts reachable IPs by RTT ascending. Unreachable are dropped. |
| 81 | func RankIPs(in []IPResult) []IPResult { |
| 82 | out := make([]IPResult, 0, len(in)) |
| 83 | for _, r := range in { |
| 84 | if r.Reachable { |
| 85 | out = append(out, r) |
| 86 | } |
| 87 | } |
| 88 | sort.Slice(out, func(i, j int) bool { return out[i].RTT < out[j].RTT }) |
| 89 | return out |
| 90 | } |
| 91 | |
| 92 | // RankSNIs keeps only OK outcomes and sorts by handshake time ascending. |
| 93 | func RankSNIs(in []Result) []Result { |
no outgoing calls
no test coverage detected