From c62c558a3ecd9a1091487e5f69a4465ad16791f0 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 9 Jan 2018 09:27:58 +0000 Subject: [PATCH 1/4] feat: dns --- README.md | 1 + src/dns.js | 25 +++++++++++++++++++++++++ src/utils/load-commands.js | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/dns.js diff --git a/README.md b/README.md index cad05cfb8..81f7bb55c 100644 --- a/README.md +++ b/README.md @@ -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)`] - [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) diff --git a/src/dns.js b/src/dns.js new file mode 100644 index 000000000..3f734bfc2 --- /dev/null +++ b/src/dns.js @@ -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) + }) +} diff --git a/src/utils/load-commands.js b/src/utils/load-commands.js index f80b1427c..5a2c84ff4 100644 --- a/src/utils/load-commands.js +++ b/src/utils/load-commands.js @@ -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 From e43eebc0d4fa2efe0e8b66f1fa9ac24fa77e67b5 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 9 Jan 2018 12:46:55 +0000 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81f7bb55c..3f2ef7007 100644 --- a/README.md +++ b/README.md @@ -253,7 +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)`] + - [`ipfs.dns(domain)`](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) From 061c54b12b2684658e839d1a26be575bf7e77034 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 9 Jan 2018 12:47:32 +0000 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f2ef7007..ed914f899 100644 --- a/README.md +++ b/README.md @@ -253,7 +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)`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#dns) + - [`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) From e1ddc433a69fe390caec44cc8e742b907f6ca50c Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 12 Jan 2018 14:02:28 +0000 Subject: [PATCH 4/4] chore: update deps --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 68d22d765..11060ee9d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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",