ipfs-companion icon indicating copy to clipboard operation
ipfs-companion copied to clipboard

Connect to known providers if dnsaddr exist for redirected gateway

Open lidel opened this issue 5 years ago • 0 comments

Capturing suggestion from https://github.com/filecoin-project/slate/issues/342#issuecomment-700948648

companion could look up a dnsaddr record for the domain when it encounters IPFS urls. So slate.host could have a txt record like /dnsaddr/slate.host/tcp/4001/ipfs/QmNodeyNodeNode and while it redirects [slate.host/ipfs/..] requests to the local daemon, also try and connect to the suggested peer, to help with situations where it is difficult to publish all the provider records to the dht.

Initial thoughts:

  • We could do DNS TXT lookup in companion, eg. leverage Cloudflare for DoH lookup (some notes in https://github.com/ipfs/helia-ipns/issues/53)
  • ...but a better way would be to have upstream support for resolving /dnsaddr in https://github.com/multiformats/js-multiaddr/issues/94
  • There is no API in browsers to do this, so we introduce security implications around leaking browser history to DoH provider that may be different than the OS-or-browser-level one chosen by the user

Alternative explanation:

yes, so its like a hint for user agent that is about to load content from public gateway, and instead wants to use native IPFS. user agent reads DNS TXT record for that public gateway and learns its multiaddr, and loads data from IPFS + preconnects to that gateway in best-effort fashion.

rationale is: if someone linked to that gateway, that gateway's ipfs datastore most likely has the data, so it makes sense to preconnect to it

lidel avatar Sep 29 '20 20:09 lidel