new: several improvements to the new.show u

This commit is contained in:
evilsocket 2018-01-29 12:26:28 +01:00
parent 646c5d14c7
commit 7abb3cbb2c
5 changed files with 135 additions and 104 deletions

View file

@ -8,9 +8,15 @@ import (
type ByAddressSorter []*net.Endpoint
func (a ByAddressSorter) Len() int { return len(a) }
func (a ByAddressSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByAddressSorter) Less(i, j int) bool { return a[i].IpAddressUint32 < a[j].IpAddressUint32 }
func (a ByAddressSorter) Len() int { return len(a) }
func (a ByAddressSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByAddressSorter) Less(i, j int) bool {
if a[i].IpAddressUint32 == a[j].IpAddressUint32 {
return a[i].HwAddress < a[j].HwAddress
} else {
return a[i].IpAddressUint32 < a[j].IpAddressUint32
}
}
type BySeenSorter []*net.Endpoint