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

feat: /api/v0/dns #665

Merged
merged 4 commits into from
Jan 12, 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"P
- [`ipfs.id([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#id)
- [`ipfs.version([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#version)
- [`ipfs.ping()`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#ping)
- [`ipfs.dns(domain, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#dns)

- [config](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/CONFIG.md)
- [`ipfs.config.get([key, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/CONFIG.md#configget)
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
"is-ipfs": "^0.3.2",
"is-stream": "^1.1.0",
"lru-cache": "^4.1.1",
"multiaddr": "^3.0.1",
"multihashes": "~0.4.12",
"multiaddr": "^3.0.2",
"multihashes": "~0.4.13",
"ndjson": "^1.5.0",
"once": "^1.4.0",
"peer-id": "~0.10.4",
"peer-info": "~0.11.4",
"promisify-es6": "^1.0.3",
"pull-defer": "^0.2.2",
"pull-pushable": "^2.1.1",
"pull-pushable": "^2.1.2",
"pump": "^1.0.3",
"qs": "^6.5.1",
"readable-stream": "^2.3.3",
Expand All @@ -66,7 +66,7 @@
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.5.1",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.38.0",
"interface-ipfs-core": "~0.40.0",
"hapi": "^16.6.2",
"ipfsd-ctl": "~0.26.0",
"pre-commit": "^1.2.2",
Expand Down
25 changes: 25 additions & 0 deletions src/dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict'

const promisify = require('promisify-es6')
const moduleConfig = require('./utils/module-config')

const transform = function (res, callback) {
callback(null, res.Path)
}

module.exports = (arg) => {
const send = moduleConfig(arg)

return promisify((args, opts, callback) => {
if (typeof (opts) === 'function') {
callback = opts
opts = {}
}

send.andTransform({
path: 'dns',
args: args,
qs: opts
}, transform, callback)
})
}
3 changes: 2 additions & 1 deletion src/utils/load-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function requireCommands () {
swarm: require('../swarm'),
pubsub: require('../pubsub'),
update: require('../update'),
version: require('../version')
version: require('../version'),
dns: require('../dns')
}

// TODO: crowding the 'files' namespace temporarily for interface-ipfs-core
Expand Down