go-ipfs version: 0.4.17-
Repo version: 7
System version: amd64/linux
Golang version: go1.10.3
Bug
I set up my website, registered domain etam-software.eu and published dnslink TXT record. Accessing through http://127.0.0.1:8080/ipns/etam-software.eu/ works fine, but ipfs-companion firefox addon is not redirecting to my gateway. I found that http api/v0/dns, which is used by addon, returns error, even though everything else works fine:
$ dig +noall +answer TXT etam-software.eu
etam-software.eu. 221 IN TXT "dnslink=/ipns/QmanzJhzCXAgry6rT7uyhwdwk9HTDSzVZ4R4mgcBy1nd1j"
$ ipfs name resolve -r etam-software.eu
/ipfs/QmZY4bqaNB8yQUFeVS87QEuNKyTLkfT5eZ1QWwoeozu8xG
$ curl http://127.0.0.1:5001/api/v0/dns/etam-software.eu?r=true
{"Message":"not a valid domain name","Code":0,"Type":"error"}
(drive-by comment)
Looks like a bug in dns command:
$ ipfs dns -r etam-software.eu
Error: not a valid domain name
$ dig +short TXT etam-software.eu
"keybase-site-verification=cyjmMyLHiHvrzT2UvcaUmMcF5FhS7Qk47QbTuhHbfMo"
"dnslink=/ipns/QmanzJhzCXAgry6rT7uyhwdwk9HTDSzVZ4R4mgcBy1nd1j"
@etam
According to the command description and code, I think ipfs dns can't resolve ipns/Qm....,
but can resolve ipns/<domain>
command description:
> dig +short TXT recursive.ipfs.io
dnslink=/ipns/ipfs.io
> ipfs dns -r recursive.ipfs.io
/ipfs/QmRzTuh2Lpuz7Gr39stNr6mTFdqAghsZec1JoUnfySUzcy
Yes. Basically, the ipfs dns command can resolve dnslink names only. If you want general-purpose name resolution, use the ipfs name resolve -r command.
However, this should be documented. Would someone like to add a note to the help text along the lines of:
Note: This command can only recursively resolve DNS links, it will fail to recursively resolve through IPNS keys etc. For general-purpose recursive resolution, use
ipfs name resolve -r.
@overbool
My main issue is that IPFS Companion is not redirecting from my website to IPFS gateway.
Now, the questions are:
I believe IPFS companion should be calling ipfs dns domain-name without -r. Then, if this succeeds, it should feed /ipns/your-domain to the IPFS gateway (which will repeat the process). Alternatively, it could call ipfs name resolve -r ... and feed the result to the IPFS gateway but I believe this will end up showing the wrong URL in the URL bar.
@lidel I believe this is a bug in companion. We could fix it here by making ipfs dns -r recurse through IPNS keys but that may have performance implications for some applications.
On the other hand, we may want to just stop at the first non-IPNS key.
I've merged the doc fix for now as that's strictly better than simply not working but we may want a better fix.
@Stebalien I agree, we can switch Companion to use ipfs name resolve -r to traverse IPNS, however we still need to fix basic ipfs dns (without -r) to work and tell us if DNSLink exists or not.
And from what I see it does not work for etam-software.eu right now:
$ ipfs dns -r etam-software.eu
Error: not a valid domain name
$ ipfs dns etam-software.eu
Error: could not resolve name (recursion limit exceeded)
$ dig +short TXT etam-software.eu
"keybase-site-verification=cyjmMyLHiHvrzT2UvcaUmMcF5FhS7Qk47QbTuhHbfMo"
"dnslink=/ipns/QmanzJhzCXAgry6rT7uyhwdwk9HTDSzVZ4R4mgcBy1nd1j"
What is worse, lookup for ipfs.io works only WITH -r and fails without it:
$ ipfs dns ipfs.io
Error: could not resolve name (recursion limit exceeded)
$ ipfs dns -r ipfs.io /ipfs/QmS4fTD7Rh8NouNhp9uZbawUdBpgHaUTeL3EnxX8Tiiu7H
$ dig +short TXT ipfs.io
"dnslink=/ipns/website.ipfs.io"
"v=spf1 a include:_spf.google.com ~all"
Just to be sure its not me, are you able to reproduce above errors?
Would it be possible to fix ipfs dns (without -r) to return dnslink as-is?
I think this would be the expected behavior:
$ ipfs dns ipfs.io
/ipns/website.ipfs.io
$ ipfs dns etam-software.eu
/ipns/QmanzJhzCXAgry6rT7uyhwdwk9HTDSzVZ4R4mgcBy1nd1j
How about: https://github.com/ipfs/go-ipfs/issues/5635