func sortUpstreamsWithRtt(u []upstreamWithRtt) map[int]int {
	idxMap := make(map[int]int, len(u))
	for i := range u {
		idxMap[i] = i
	}
	sort.Slice(u, func(i, j int) bool {
		if u[i].rtt < u[j].rtt {
			lessRttIdx := idxMap[i]
			greaterRttIdx := idxMap[j]
			idxMap[i] = greaterRttIdx
			idxMap[j] = lessRttIdx
			return true
		}
		return false
	})

	return idxMap
}
// sortUpstreamsWithRtt returns map of indexes in original and sorted slices
sortUpstreamsWithRtt returns map of indexes in original and sorted slices
// sortUpstreamsWithRtt returns map of indexes in original and sorted slices
func sortUpstreamsWithRtt(u []upstreamWithRtt) map[int]int {
	idxMap := make(map[int]int, len(u))
	for i := range u {
		idxMap[i] = i
	}
	sort.Slice(u, func(i, j int) bool {
		if u[i].rtt < u[j].rtt {
			lessRttIdx := idxMap[i]
			greaterRttIdx := idxMap[j]
			idxMap[i] = greaterRttIdx
			idxMap[j] = lessRttIdx
			return true
		}
		return false
	})
	return idxMap
}
func sortUpstreamsWithRtt ( u [ ] upstreamWithRtt ) map [ int ] int { idxMap := make ( map [ int ] int , len ( u ) ) for i := range u { idxMap [ i ] = i } sort . Slice ( u , func ( i , j int ) bool { if u [ i ] . rtt < u [ j ] . rtt { lessRttIdx := idxMap [ i ] greaterRttIdx := idxMap [ j ] idxMap [ i ] = greaterRttIdx idxMap [ j ] = lessRttIdx return true } return false } ) return idxMap }
sortUpstreamsWithRtt returns map of indexes in original and sorted slices
sortUpstreamsWithRtt returns map of indexes in original and sorted slices