From 7aca07e2bea6fc11f0a2a1f07d5328ba7effca18 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sat, 20 Dec 2014 13:49:22 -0800 Subject: [PATCH] Routing interface uses peer.PeerInfo Providers are records that need Addresses. The routing system needs to provide -- not only the ID, but also -- the peer's Addresses. A peer.PeerInfo is a small struct to pass around a peer.ID and []ma.Multiaddr. --- routing/routing.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/routing/routing.go b/routing/routing.go index 09773f20b..ae9acad44 100644 --- a/routing/routing.go +++ b/routing/routing.go @@ -16,7 +16,7 @@ var ErrNotFound = errors.New("routing: not found") // IpfsRouting is the routing module interface // It is implemented by things like DHTs, etc. type IpfsRouting interface { - FindProvidersAsync(context.Context, u.Key, int) <-chan peer.Peer + FindProvidersAsync(context.Context, u.Key, int) <-chan peer.PeerInfo // Basic Put/Get @@ -33,6 +33,7 @@ type IpfsRouting interface { Provide(context.Context, u.Key) error // Find specific Peer - // FindPeer searches for a peer with given ID. - FindPeer(context.Context, peer.ID) (peer.Peer, error) + // FindPeer searches for a peer with given ID, returns a peer.PeerInfo + // with relevant addresses. + FindPeer(context.Context, peer.ID) (peer.PeerInfo, error) }