This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,83 @@ | ||
DHT API | ||
======= | ||
|
||
#### `findpeer` | ||
|
||
> Retrieve the Peer Info of a reachable node in the network. | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.dht.findpeer(peerId, [callback]) | ||
|
||
Where `peerId` is a IPFS/libp2p Id of type [PeerId](https://github.com/libp2p/js-peer-id). | ||
|
||
`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) | ||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
Example: | ||
|
||
```JavaScript | ||
var id = PeerId.create() | ||
ipfs.dht.findPeer(id, function (err, peerInfo) { | ||
// peerInfo will contain the multiaddrs of that peer | ||
}) | ||
``` | ||
|
||
#### `findprovs` | ||
|
||
> Retrieve the providers for content that is addressed by an hash. | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.dht.findprovs(hash, [callback]) | ||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
Example: | ||
|
||
|
||
|
||
#### `get` | ||
|
||
> | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.dht.get(key, [callback]) | ||
|
||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
Example: | ||
|
||
|
||
#### `put` | ||
|
||
> | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.dht.put(key, value, [callback]) | ||
|
||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
Example: | ||
|
||
|
||
#### `query` | ||
|
||
> | ||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.dht.query(peerId, [callback]) | ||
|
||
|
||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
Example: | ||
|
||
|