hid_show_sort.go 589 B

12345678910111213141516171819
  1. package hid
  2. import (
  3. "github.com/bettercap/bettercap/network"
  4. )
  5. type ByHIDMacSorter []*network.HIDDevice
  6. func (a ByHIDMacSorter) Len() int { return len(a) }
  7. func (a ByHIDMacSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
  8. func (a ByHIDMacSorter) Less(i, j int) bool {
  9. return a[i].Address < a[j].Address
  10. }
  11. type ByHIDSeenSorter []*network.HIDDevice
  12. func (a ByHIDSeenSorter) Len() int { return len(a) }
  13. func (a ByHIDSeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
  14. func (a ByHIDSeenSorter) Less(i, j int) bool { return a[i].LastSeen.Before(a[j].LastSeen) }