-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement DNS query API #904
Comments
I want to emphasize that DNS TXT lookup needs to work in "browserified" version of |
Thanks for opening this up, @lidel :)
I think that the answer is We can implement this in the Node.js only version. |
Hm.. that is unfortunate 🙃 Perhaps we could fallback to HTTP-based queries when in browser contexts?
The question remains: should this fallback be hidden from API consumers and handled internally by |
@hacdias shipped this one! 👏🏽❤️🤘🏽 Thank you! |
Background
The
/api/v0/dns/
API was created ingo-ipfs
as a workaround for doingdnslink
lookups in webpage and browser addon contexts (ipfs/kubo#1054, ipfs/ipfs-companion#44).Problem
Mozilla bug #1343849 means we won't have a native WebExtension API for DNS TXT lookups. Even if Mozilla decides to add a custom API for this to Firefox, it won't be present in Chromium-based browsers.
Our long term goal is to have an option to run
js-ipfs
node in WebExtension (ipfs/ipfs-companion#248) without relying on external HTTP Gateway provided bygo-ipfs
.Solution
We need a robust, portable DNS lookup solution that works everywhere. This means
js-ipfs
needs to provide in-house implementation for/api/v0/dns/
that works in "browserified" version. We won't be able to supportdnslink
in web browsers without it.Request-Response Examples
DNS lookup API is already implemented by
go-ipfs
(ipfs/kubo#1054):Site with
dnslink
:GET http://localhost:5001/api/v0/dns/ipfs.io
Site without
dnslink
inTXT
record:GET http://localhost:5001/api/v0/dns/google.com
:Other thoughts
js-ipfs
to improve performance of multiple API requests asking for the same domain in short period of time,js-ipfs-api
should provide support for this API (Support for /api/v0/dns/ ipfs-inactive/js-ipfs-http-client#501).The text was updated successfully, but these errors were encountered: