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

Commit

Permalink
feat(dht): add dht.findpeer spec
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 9, 2016
1 parent 1791644 commit 0deb6ad
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions API/dht/README.md
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:


0 comments on commit 0deb6ad

Please sign in to comment.