Commit e1427950 authored by Jeromy's avatar Jeromy
Browse files

remove dependency on key

parent d68ac4ce
...@@ -11,12 +11,8 @@ import ( ...@@ -11,12 +11,8 @@ import (
peer "github.com/ipfs/go-libp2p/p2p/peer" peer "github.com/ipfs/go-libp2p/p2p/peer"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
key "github.com/whyrusleeping/go-key"
) )
// Map maps Keys (Peer.IDs) to Connections.
type Map map[key.Key]Conn
type PeerConn interface { type PeerConn interface {
io.Closer io.Closer
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
ks "Qma4vHVBYKDiKS5VpvtLNJHHDbL7S6VRsvxxmBnBFfKP3k/go-keyspace" ks "Qma4vHVBYKDiKS5VpvtLNJHHDbL7S6VRsvxxmBnBFfKP3k/go-keyspace"
peer "github.com/ipfs/go-libp2p/p2p/peer" peer "github.com/ipfs/go-libp2p/p2p/peer"
key "github.com/whyrusleeping/go-key"
) )
// peerMetric tracks a peer and its distance to something else. // peerMetric tracks a peer and its distance to something else.
...@@ -93,9 +92,9 @@ func (pq *distancePQ) Dequeue() peer.ID { ...@@ -93,9 +92,9 @@ func (pq *distancePQ) Dequeue() peer.ID {
// NewXORDistancePQ returns a PeerQueue which maintains its peers sorted // NewXORDistancePQ returns a PeerQueue which maintains its peers sorted
// in terms of their distances to each other in an XORKeySpace (i.e. using // in terms of their distances to each other in an XORKeySpace (i.e. using
// XOR as a metric of distance). // XOR as a metric of distance).
func NewXORDistancePQ(fromKey key.Key) PeerQueue { func NewXORDistancePQ(from string) PeerQueue {
return &distancePQ{ return &distancePQ{
from: ks.XORKeySpace.Key([]byte(fromKey)), from: ks.XORKeySpace.Key([]byte(from)),
heap: peerMetricHeap{}, heap: peerMetricHeap{},
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment