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

feat: /api/v0/dns #197

Merged
merged 2 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions SPEC/MISCELLANEOUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,26 @@ ipfs.version((err, version) => {
A great source of [examples][] can be found in the tests for this API.

[examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/generic.js

#### `dns`

> Resolve DNS links

##### `Go` **WIP**

##### `JavaScript` - ipfs.dns(domain, [callback])

`callback` must follow `function (err, path) {}` signature, where `err` is an error if the operation was not successful. `path` is the IPFS path for that domain.

If no `callback` is passed, a promise is returned.

**Example:**

```JavaScript
ipfs.dns('ipfs.io', (err, path) => {
if (err) {
throw err
}
console.log(path)
})
```
14 changes: 14 additions & 0 deletions src/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ module.exports = (common) => {
})
})

it('.dns', () => {
return ipfs.dns('ipfs.io', (err, path) => {
expect(err).to.not.exist()
expect(path).to.exist()
})
})

it('.id Promises support', () => {
return ipfs.id()
.then((res) => {
Expand All @@ -66,5 +73,12 @@ module.exports = (common) => {
expect(result).to.have.a.property('repo')
})
})

it('.dns Promises support', () => {
return ipfs.dns('ipfs.io')
.then((res) => {
expect(res).to.exist()
})
})
})
}