Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: /api/v0/dns (#665)
Browse files Browse the repository at this point in the history
* feat: dns

* Update README.md

* Update README.md

* chore: update deps
  • Loading branch information
hacdias authored and daviddias committed Jan 12, 2018
1 parent eba9ae5 commit 81016bb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,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

0 comments on commit 81016bb

Please sign in to comment.