Skip to content

Commit

Permalink
fix: support DNSLink with dnslink=/ipns/{libp2p-key} (#959)
Browse files Browse the repository at this point in the history
* 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 <jorge@ktlxv.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
3 people authored Jan 17, 2021
1 parent dbed296 commit e61c891
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion add-on/src/lib/dnslink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e61c891

Please sign in to comment.