From bc0ab5ed57b00eace812f62bc7a5bbbfbe41c758 Mon Sep 17 00:00:00 2001 From: phelixnmc Date: Fri, 5 Feb 2016 15:23:29 +0100 Subject: [PATCH] ipfs support --- plugin/pluginDns.py | 10 ++++++++++ plugin/pluginNamespaceDomain.py | 1 + 2 files changed, 11 insertions(+) diff --git a/plugin/pluginDns.py b/plugin/pluginDns.py index f5a0679..7fd2203 100644 --- a/plugin/pluginDns.py +++ b/plugin/pluginDns.py @@ -56,6 +56,7 @@ class pluginDns(plugin.PluginThread): 'getIp4': [1, 1, '', 'Get a list of IPv4 for the domain'], 'getIp6': [1, 1, '', 'Get a list of IPv6 for the domain'], 'getOnion': [1, 1, '', 'Get the .onion for the domain'], + 'getIpfs': [1, 1, '', 'Get the ipfs address for the domain'], 'getI2p': [1, 1, '', 'Get the i2p config for the domain'], 'getI2p_b32': [1, 1, '', 'Get the i2p base32 config for the domain'], 'getFreenet': [1, 1, '', 'Get the freenet config for the domain'], @@ -109,6 +110,11 @@ def _getRecordForRPC(self, domain, recType): if not recType in ['getOnion', 'getFingerprint', 'getTls']: #ToDo: support translate return '[]' domain = domain[:-8] + 'bit' + for ext in ['_ipfs.bit', 'b-i', 'ipfs', 'i']: + if domain.endswith(ext): + if not recType is 'getIpfs': + return '[]' + domain = domain[:-len(ext)] + 'bit' if domain.endswith('_i2p.bit'): if not recType in ['getI2p', 'getI2p_b32', 'getFingerprint', 'getTls']: #ToDo: support translate return '[]' @@ -163,6 +169,10 @@ def getIp6(self, domain): def getOnion(self, domain): return self._getRecordForRPC(domain, 'getOnion') + @plugin.public + def getIpfs(self, domain): + return self._getRecordForRPC(domain, 'getIpfs') + @plugin.public def getI2p(self, domain): return self._getRecordForRPC(domain, 'getI2p') diff --git a/plugin/pluginNamespaceDomain.py b/plugin/pluginNamespaceDomain.py index 5cafa49..cb96b4e 100644 --- a/plugin/pluginNamespaceDomain.py +++ b/plugin/pluginNamespaceDomain.py @@ -20,6 +20,7 @@ class pluginNamespaceDomain(plugin.PluginThread): 'getIp4' : 'ip', 'getIp6' : 'ip6', 'getOnion' : 'tor', + 'getIpfs' : 'ipfs', 'getI2p' : 'i2p', 'getI2p_b32' : 'i2p_b32', 'getFreenet' : 'freenet',