forked from TRON-US/interface-go-btfs-core
-
Notifications
You must be signed in to change notification settings - Fork 11
/
dht.go
27 lines (20 loc) · 902 Bytes
/
dht.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package iface
import (
"context"
path "github.com/bittorrent/interface-go-btfs-core/path"
"github.com/bittorrent/interface-go-btfs-core/options"
"github.com/libp2p/go-libp2p/core/peer"
)
// DhtAPI specifies the interface to the DHT
// Note: This API will likely get deprecated in near future, see
// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context.
type DhtAPI interface {
// FindPeer queries the DHT for all of the multiaddresses associated with a
// Peer ID
FindPeer(context.Context, peer.ID) (peer.AddrInfo, error)
// FindProviders finds peers in the DHT who can provide a specific value
// given a key.
FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan peer.AddrInfo, error)
// Provide announces to the network that you are providing given values
Provide(context.Context, path.Path, ...options.DhtProvideOption) error
}