new: net.show by seen command to sort by last seen date

This commit is contained in:
evilsocket 2018-01-21 11:25:52 +01:00
commit 3a55b03ad0
2 changed files with 19 additions and 3 deletions

View file

@ -9,3 +9,9 @@ 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 }
type BySeenSorter []*net.Endpoint
func (a BySeenSorter) Len() int { return len(a) }
func (a BySeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a BySeenSorter) Less(i, j int) bool { return a[i].LastSeen.Before(a[j].LastSeen) }