DNSLink Support in IPFS Companion
TL;DR when in doubt use the "best-effort" policy
What is DNSLink?
DNSLink is mapping a domain name to an IPFS address by means of DNS TXT record.
Read DNSLink guide for details such as setting it up on your own website.
Results of DNS TXT lookups are stored in a LRU cache of size 1000 and max-age 12h (we will support original TTL from DNS soon).
The cache is in-memory and is not persisted between restarts.
DNS TXT Lookup Policies
There will be no DNS TXT lookups when this policy is selected.
It means DNSLink support is disabled.
Check after HTTP request (best-effort)
This is the most efficient lookup strategy, but in rare cases it may yield false-negatives on the first load.
DNSLink redirect is enabled and happens before HTTP request if DNSLink is already in cache. If not in cache, DNS TXT lookup is executed and cached in the background without blocking the page load.
Blocking lookups are executed only for domains which returned an HTTP response with x-ipfs-path header or returned a connection error.
Check before HTTP request (enabled)
DNS TXT lookup is executed for every hostname before any HTTP request is made. No false-negatives.
It removes the need for sending HTTP request to remote server if DNSLink is present, but may impact browser performance: every request to a new domain name will be blocked until TXT lookup is finished.
There is a room for improvement: web browsers do not expose efficient DNS TXT
lookup API (yet) and HTTP-based lookups via
with userland caching are used as a fallback.