comparePrintableName compares NodeInfo lexicographically the same way as `i.PrintableName() < right.PrintableName()`, but much more performant.
(right NodeInfo)
| 198 | |
| 199 | // comparePrintableName compares NodeInfo lexicographically the same way as `i.PrintableName() < right.PrintableName()`, but much more performant. |
| 200 | func (i *NodeInfo) comparePrintableName(right NodeInfo) (equal bool, less bool) { |
| 201 | if right == *i { |
| 202 | return true, false |
| 203 | } |
| 204 | |
| 205 | if i.Address != 0 && right.Address != 0 && i.Address != right.Address { |
| 206 | // comparing ints directly is the same as comparing padded hex from fmt.Sprintf("%016x", Address) |
| 207 | return false, i.Address < right.Address |
| 208 | } |
| 209 | |
| 210 | // fallback |
| 211 | return false, i.PrintableName() < right.PrintableName() |
| 212 | } |
| 213 | |
| 214 | // NodeMap maps from a node info struct to a node. It is used to merge |
| 215 | // report entries with the same info. |