Skip to content

Commit

Permalink
Remove old DND TXT schema
Browse files Browse the repository at this point in the history
As for now only dnslink is valid.
Fixes ipfs#760

License: MIT
Signed-off-by: Jakub (Kubuxu) Sztandera <kubuxu@gmail.com>
  • Loading branch information
Kubuxu committed Dec 29, 2015
1 parent 69e3672 commit f205360
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions namesys/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path,
}

func parseEntry(txt string) (path.Path, error) {
p, err := path.ParseKeyToPath(txt) // bare IPFS multihashes
if err == nil {
return p, nil
}

return tryParseDnsLink(txt)
}

func tryParseDnsLink(txt string) (path.Path, error) {
parts := strings.SplitN(txt, "=", 2)
if len(parts) == 2 && parts[0] == "dnslink" {
return path.ParsePath(parts[1])
Expand Down
2 changes: 1 addition & 1 deletion namesys/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func (m *mockDNS) lookupTXT(name string) (txt []string, err error) {

func TestDnsEntryParsing(t *testing.T) {
goodEntries := []string{
"QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
"dnslink=/ipns/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/foo",
Expand All @@ -34,6 +33,7 @@ func TestDnsEntryParsing(t *testing.T) {
"dnslink=",
"dnslink=/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/foo",
"dnslink=ipns/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/bar",
"QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", // Old schema, no longer valid
}

for _, e := range goodEntries {
Expand Down

0 comments on commit f205360

Please sign in to comment.