Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit daf892d

Browse files
daviddiasvictorb
authored andcommitted
feat(dht): add dht.findpeer spec
1 parent 4870685 commit daf892d

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

API/dht/README.md

+80
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,83 @@
11
DHT API
22
=======
33

4+
#### `findpeer`
5+
6+
> Retrieve the Peer Info of a reachable node in the network.
7+
8+
##### `Go` **WIP**
9+
10+
##### `JavaScript` - ipfs.dht.findpeer(peerId, [callback])
11+
12+
Where `peerId` is a IPFS/libp2p Id of type [PeerId](https://github.com/libp2p/js-peer-id).
13+
14+
`callback` must follow `function (err, peerInfo) {}` signature, where `err` is an error if the operation was not successful. `peerInfo` is an object of type [PeerInfo](https://github.com/libp2p/js-peer-info)
15+
16+
If no `callback` is passed, a promise is returned.
17+
18+
Example:
19+
20+
```JavaScript
21+
var id = PeerId.create()
22+
ipfs.dht.findPeer(id, function (err, peerInfo) {
23+
// peerInfo will contain the multiaddrs of that peer
24+
})
25+
```
26+
27+
#### `findprovs`
28+
29+
> Retrieve the providers for content that is addressed by an hash.
30+
31+
##### `Go` **WIP**
32+
33+
##### `JavaScript` - ipfs.dht.findprovs(hash, [callback])
34+
35+
If no `callback` is passed, a promise is returned.
36+
37+
Example:
38+
39+
40+
41+
#### `get`
42+
43+
>
44+
45+
##### `Go` **WIP**
46+
47+
##### `JavaScript` - ipfs.dht.get(key, [callback])
48+
49+
50+
If no `callback` is passed, a promise is returned.
51+
52+
Example:
53+
54+
55+
#### `put`
56+
57+
>
58+
59+
##### `Go` **WIP**
60+
61+
##### `JavaScript` - ipfs.dht.put(key, value, [callback])
62+
63+
64+
If no `callback` is passed, a promise is returned.
65+
66+
Example:
67+
68+
69+
#### `query`
70+
71+
>
72+
73+
##### `Go` **WIP**
74+
75+
##### `JavaScript` - ipfs.dht.query(peerId, [callback])
76+
77+
78+
79+
If no `callback` is passed, a promise is returned.
80+
81+
Example:
82+
83+

0 commit comments

Comments
 (0)