searchToken returns the offset of the tokens entry holding the range for the provided key.
(tokens []uint32, key uint32)
| 141 | |
| 142 | // searchToken returns the offset of the tokens entry holding the range for the provided key. |
| 143 | func searchToken(tokens []uint32, key uint32) int { |
| 144 | i := sort.Search(len(tokens), func(x int) bool { |
| 145 | return tokens[x] > key |
| 146 | }) |
| 147 | if i >= len(tokens) { |
| 148 | i = 0 |
| 149 | } |
| 150 | return i |
| 151 | } |
| 152 | |
| 153 | // GetFirstAddressOf returns the first IPv4 address of the supplied interface names, omitting any 169.254.x.x automatic private IPs if possible. |
| 154 | func getFirstAddressOf(names []string, logger log.Logger) (string, error) { |
no outgoing calls
no test coverage detected