diff --git a/compconfig.go b/compconfig.go index d259c44..ebfab3c 100644 --- a/compconfig.go +++ b/compconfig.go @@ -4,7 +4,9 @@ import ( "context" "time" + "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p-routing-helpers/tracing" + "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/routing" "github.com/multiformats/go-multihash" ) @@ -37,3 +39,11 @@ type ReadyAbleRouter interface { type ComposableRouter interface { Routers() []routing.Routing } + +// A DHTRouter provides DHT-specific operations. +type DHTRouter interface { + // GetClosestPeers returns the DHT closest peers to the given peer ID. + // If empty, it will use the content router's peer ID + // (self). + GetClosestPeers(ctx context.Context, key cid.Cid) (<-chan peer.AddrInfo, error) +}