6 "github.com/anacrolix/torrent"
9 type ByInfoHash []*torrent.Torrent
11 func (a ByInfoHash) Len() int {
15 func (a ByInfoHash) Swap(i, j int) {
16 a[i], a[j] = a[j], a[i]
19 func (a ByInfoHash) Less(i, j int) bool {
20 return a[i].InfoHash().HexString() < a[j].InfoHash().HexString()
23 type ByPeerID []*torrent.PeerConn
25 func (a ByPeerID) Len() int {
29 func (a ByPeerID) Swap(i, j int) {
30 a[i], a[j] = a[j], a[i]
33 func (a ByPeerID) Less(i, j int) bool {
34 return hex.EncodeToString(a[i].PeerID[:]) < hex.EncodeToString(a[j].PeerID[:])