]> Sergey Matveev's repositories - btrtrc.git/blobdiff - cmd/btrtrc/sort.go
fifos/top-seed
[btrtrc.git] / cmd / btrtrc / sort.go
index cfb6478c68eda6be163cc026075db62998cdd5af..5b1ad858ff88de7c1e6a006bf0de92281ad1a2ce 100644 (file)
@@ -20,6 +20,20 @@ func (a ByInfoHash) Less(i, j int) bool {
        return a[i].InfoHash().HexString() < a[j].InfoHash().HexString()
 }
 
+type ByTxTraffic []*topTorrent
+
+func (a ByTxTraffic) Len() int {
+       return len(a)
+}
+
+func (a ByTxTraffic) Swap(i, j int) {
+       a[i], a[j] = a[j], a[i]
+}
+
+func (a ByTxTraffic) Less(i, j int) bool {
+       return a[i].tx < a[j].tx
+}
+
 type ByPeerID []*torrent.PeerConn
 
 func (a ByPeerID) Len() int {