refact: starting refactoring new.show sorting in separate file

This commit is contained in:
evilsocket 2018-01-21 11:13:26 +01:00
parent 97c97a668a
commit 1367663aa1
2 changed files with 12 additions and 7 deletions

11
modules/net_recon_sort.go Normal file
View file

@ -0,0 +1,11 @@
package modules
import (
"github.com/evilsocket/bettercap-ng/net"
)
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 }