Go-ipfs: Add TTL to /api/v0/dns

Created on 2 Jan 2019  ·  2Comments  ·  Source: ipfs/go-ipfs

Version information:

0.4.18

Type:

enhancement

Description:

Historical background can be found in https://github.com/ipfs/go-ipfs/issues/1054

DNS query API at /api/v0/dns resolves FQDN to IPFS path (if DNSLink exists).

It is heavily used by ipfs-companion however we don't know for how long DNSLink (DNS TXT record) is valid and use a static cache expiration value, which has its downsides.

Ideally, we would add an opt-in --ttl flag to extend response of /api/v0/dns and use actual TTL in cache expiration logic.

A response with --ttl could look like this:

{
  "Path": "/ipfs/QmS4fTD7Rh8NouNhp9uZbawUdBpgHaUTeL3EnxX8Tiiu7H",
  "TTL": 60,
}

For what its worth I did a quick check and go-ipfs/namesys uses net.LookupTXT which returns strings with text, but no TTL, so I imagine standard library is not enough, and we would have to introduce more advanced DNS library to make this work.

Does this sound feasible on go-ipfs end?
What would be the next step?

dihard good first issue help wanted

Most helpful comment

if another DNS library needs to be used https://github.com/miekg/dns looks pretty thorough

All 2 comments

This probably is going to be a bit more involved since the default Go resolver doesn't expose TTL - https://golang.org/pkg/net/#LookupTXT and I don't see any obvious workaround

if another DNS library needs to be used https://github.com/miekg/dns looks pretty thorough

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zignig picture zignig  ·  3Comments

funkyfuture picture funkyfuture  ·  3Comments

ArcticLampyrid picture ArcticLampyrid  ·  3Comments

kallisti5 picture kallisti5  ·  3Comments

daviddias picture daviddias  ·  3Comments