Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Implement DNS query API #904

Closed
lidel opened this issue Jul 9, 2017 · 4 comments
Closed

Implement DNS query API #904

lidel opened this issue Jul 9, 2017 · 4 comments
Assignees
Labels
exp/wizard Extensive knowledge (implications, ramifications) required help wanted Seeking public contribution on this issue P3 Low: Not priority right now

Comments

@lidel
Copy link
Member

lidel commented Jul 9, 2017

Background

The /api/v0/dns/ API was created in go-ipfs as a workaround for doing dnslink 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 support dnslink 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

{"Path":"/ipfs/QmbB5He9XBy7TpsuEwF8twUA2FvK4x8DTUjsANVaQAPDDh"}

Site without dnslink in TXT record:

GET http://localhost:5001/api/v0/dns/google.com:

{"Message":"could not resolve name.","Code":0}

Other thoughts

@lidel
Copy link
Member Author

lidel commented Jul 9, 2017

I want to emphasize that DNS TXT lookup needs to work in "browserified" version of js-ipfs.
Is it even technically feasible?

@daviddias
Copy link
Member

Thanks for opening this up, @lidel :)

I want to emphasize that DNS TXT lookup needs to work in "browserified" version of js-ipfs.
Is it even technically feasible?

I think that the answer is no and you provided the answer on your first comment #904 (comment)

We can implement this in the Node.js only version.

@lidel
Copy link
Member Author

lidel commented Jul 9, 2017

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 js-ipfs, js-ipfs-api or is it something every client needs to anticipate and implement over and over again?

@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Jul 9, 2017
@daviddias daviddias added exp/wizard Extensive knowledge (implications, ramifications) required help wanted Seeking public contribution on this issue P3 Low: Not priority right now labels Jul 26, 2017
@daviddias daviddias added status/ready Ready to be worked and removed status/deferred Conscious decision to pause or backlog labels Sep 13, 2017
@daviddias
Copy link
Member

@hacdias shipped this one! 👏🏽❤️🤘🏽 Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/wizard Extensive knowledge (implications, ramifications) required help wanted Seeking public contribution on this issue P3 Low: Not priority right now
Projects
None yet
Development

No branches or pull requests

3 participants