From e61c89157bac5c56e0504c83c5ddf8f53d67a994 Mon Sep 17 00:00:00 2001 From: Ktl-XV Date: Sun, 17 Jan 2021 17:19:43 -0600 Subject: [PATCH] fix: support DNSLink with dnslink=/ipns/{libp2p-key} (#959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: change DNS resolution endpoint to allow ipns recursive resolution * fix: make DNSLink check non-recursive Given the current codebase, I believe we could make it a bit faster by passing ?r=false (we only want to know if DNSLink is present, don't need to resolve recursively, especially when users start using /ipns/{libp2p-key} in DNSLink) Co-authored-by: Jorge PĂ©rez Co-authored-by: Marcin Rataj --- add-on/src/lib/dnslink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add-on/src/lib/dnslink.js b/add-on/src/lib/dnslink.js index b27736f44..c9c44201b 100644 --- a/add-on/src/lib/dnslink.js +++ b/add-on/src/lib/dnslink.js @@ -138,7 +138,7 @@ module.exports = function createDnslinkResolver (getState) { // js-ipfs-api does not provide method for fetching this // TODO: revisit after https://github.com/ipfs/js-ipfs-api/issues/501 is addressed // TODO: consider worst-case-scenario fallback to https://developers.google.com/speed/public-dns/docs/dns-over-https - const apiCall = `${apiProvider}api/v0/dns/${fqdn}?r=true` + const apiCall = `${apiProvider}api/v0/name/resolve/${fqdn}?r=false` const xhr = new XMLHttpRequest() // older XHR API us used because window.fetch appends Origin which causes error 403 in go-ipfs // synchronous mode with small timeout // (it is okay, because we do it only once, then it is cached and read via readAndCacheDnslink)