Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to leverage /dnsaddr for peer/content/routing #193

Open
Winterhuman opened this issue May 20, 2022 · 4 comments
Open

Document how to leverage /dnsaddr for peer/content/routing #193

Winterhuman opened this issue May 20, 2022 · 4 comments
Labels
need/analysis Needs further analysis before proceeding need/community-input Needs input from the wider community P3 Low: Not priority right now specs

Comments

@Winterhuman
Copy link

Winterhuman commented May 20, 2022

Related: ipfs/kubo#3926

Browsers have a few properties that can be exploited for use by IPFS:

  • Users will visit many websites by themselves, typically visiting popular websites with good uptime.
  • Browsers can resolve DNS by themselves (even using DNS-over-HTTPS).
  • And related to this, websites have the option to create TXT records like dnsaddr=/ip4/1.2.3.4/tcp/567/p2p/PeerID so /dnsaddr/domain.tld can function.

This puts browsers in a unique position, browsers naturally discover many websites and thus many potential bootstrap nodes just from user behaviour, I propose encouraging browsers to exploit this behaviour to benefit IPFS bootstraping. Here's an example scenario to demonstrate:

  1. A user goes to https://website.tld in their browser, this website happens to have TXT records which contain DNSAddr values.
  2. The browser has a few options:
    • Trust all - Add any DNSAddr values it finds to it's own bootstrap list.
    • Trust whitelist - Have a whitelist of popular domains whose DNSAddr values are trusted by default (likely exposed in the GUI so users can expand the list).
    • Trust user - Prompt the user, perhaps in the security padlock menu, if https://website.tld's DNSAddr values should be saved.
  3. If trusted, the browser will add the values found at _dnsaddr.website.tld to it's own bootstrap list.

This system provides resilience to bootstrap downtime and censorship by expanding the bootstrap list to include a wide selection of trusted entities, this also has the potential to reduce latency by contacting bootstraps which are geographically closer.

@Winterhuman Winterhuman added the need/triage Needs initial labeling and prioritization label May 20, 2022
@ipfs ipfs deleted a comment from welcome bot May 23, 2022
@lidel
Copy link
Member

lidel commented May 23, 2022

Bad news

Resolving TXT records does not happen in web browsers. Nor there is any API for that, even WebExtensions are lacking this capability (Firefox bug from 2018, chromium is even worse because it has no DNS API at all).

This means TXT resolution is possible only when native IPFS node/support is involved (e.g. go-ipfs, Brave). And this occurs only when a DNSLink website or a Public Gateway URL (see is-ipfs) is redirected to a local IPFS node.

Due to this, I don't think this will provide way to "passively discover bootstrappers".
Instead, we are looking into saving all discovered peers across restarts – see wip work in ipfs/kubo#8856

Good news

Value added for DNSLink websites

I think that is still useful: we can leverage DNSAddr as alternative content routing method to speed up DNSLink website load times by immediatelly getting peers providing the data.

IPFS node that tries to resolve /ipns/en.wikipedia-on-ipfs.org would

  1. Resolve DNSLink TXT record with dnslink=/ipfs/{cid} (latest snapshot)
  2. Resolve DNSAddr TXT records with multiaddrs that are known to provide the content
  3. (if DNSAddr was present) attempt to preconnect to mentioned peers. if this fails, nothing happens, we just want for regular DHT lookup to finish.

Value added for services without DHT support

DNSAddr would also provide value for Services that expose Gateway, but do not announce data on DHT (such as some Pinning Services, that provide their own Gateway).

Web browser with IPFS support (Brave, ipfs-companion) could detect DNSAddr records present on their public gateway domain name, and preconnect to dnsaddr peers that provide the data, allowing for the content to load from local node just fine.

@lidel lidel changed the title DNS-based bootstrap list extensions Document how to leverage /dnsaddr for peer/content/routing Jun 6, 2022
@lidel lidel added specs and removed need/triage Needs initial labeling and prioritization labels Jun 6, 2022
@lidel
Copy link
Member

lidel commented Jun 6, 2022

I included DNSaddr section in DNSLINK_GATEWAY.md in ipfs/specs#283 – feedback appreciated!

@lidel lidel added P3 Low: Not priority right now need/analysis Needs further analysis before proceeding need/community-input Needs input from the wider community labels Jun 6, 2022
@Winterhuman
Copy link
Author

Winterhuman commented Jul 29, 2022

@lidel Assuming ipfs/specs#296 goes through, could we potentially allow exporting TXT records as well in order to get around needing an API from the browser? That way, the TXT records can be fetched from IPFS with DNSSEC allowing the records to be authenticated

@lidel
Copy link
Member

lidel commented Jul 29, 2022

Including DNSAddr DNSSEC chain of trust proofs is a good idea.
I've added below to my review:

  • Fetch DNSSEC proof for both DNSLink and DNSAddr
    • DNSAddr TXT records work the same as DNSLink ones, but for peer routing. They are optional, but their presence allows fast recovery when HTTP is down, skipping DHT lookup and opportunistically doing bitswap with trusted provider endpoint etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/analysis Needs further analysis before proceeding need/community-input Needs input from the wider community P3 Low: Not priority right now specs
Projects
None yet
Development

No branches or pull requests

2 participants