Skip to content

Commit

Permalink
refactor: remove proquint.go
Browse files Browse the repository at this point in the history
See discussion in:
ipfs/go-namesys#13 (review)


This commit was moved from ipfs/go-namesys@aa54bc9
  • Loading branch information
lidel authored and vyzo committed Apr 23, 2021
1 parent 6f288d9 commit b5662a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 47 deletions.
4 changes: 2 additions & 2 deletions namesys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
Package namesys defines `Resolver` and `Publisher` interfaces for IPNS paths, that is, paths in the form of `/ipns/<name_to_be_resolved>`. A "resolved" IPNS path becomes an `/ipfs/<cid>` path.

Traditionally, these paths would be in the form of `/ipns/peer_id`, which references an IPNS record in a distributed `ValueStore` (usually the IPFS DHT).
Traditionally, these paths would be in the form of `/ipns/{libp2p-key}`, which references an IPNS record in a distributed `ValueStore` (usually the IPFS DHT).

Additionally, the /ipns/ namespace can also be used with domain names that use DNSLink (/ipns/my.domain.example, see https://dnslink.io) and proquint strings.
Additionally, the `/ipns/` namespace can also be used with domain names that use DNSLink (`/ipns/en.wikipedia-on-ipfs.org`, see https://docs.ipfs.io/concepts/dnslink/).

The package provides implementations for all three resolvers.

Expand Down
16 changes: 5 additions & 11 deletions namesys/namesys.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//
// Additionally, the /ipns/ namespace can also be used with domain names that
// use DNSLink (/ipns/<dnslink_name>, https://docs.ipfs.io/concepts/dnslink/)
// and proquint strings.
//
// The package provides implementations for all three resolvers.
package namesys
Expand Down Expand Up @@ -38,15 +37,14 @@ import (
// Uses several Resolvers:
// (a) IPFS routing naming: SFS-like PKI names.
// (b) dns domains: resolves using links in DNS TXT records
// (c) proquints: interprets string as the raw byte data.
//
// It can only publish to: (a) IPFS routing naming.
//
type mpns struct {
ds ds.Datastore

dnsResolver, proquintResolver, ipnsResolver resolver
ipnsPublisher Publisher
dnsResolver, ipnsResolver resolver
ipnsPublisher Publisher

staticMap map[string]path.Path
cache *lru.Cache
Expand Down Expand Up @@ -125,7 +123,6 @@ func NewNameSystem(r routing.ValueStore, opts ...Option) (NameSystem, error) {
ns.dnsResolver = NewDNSResolver(madns.DefaultResolver.LookupTXT)
}

ns.proquintResolver = new(ProquintResolver)
ns.ipnsResolver = NewIpnsResolver(r)
ns.ipnsPublisher = NewIpnsPublisher(r, ns.ds)

Expand Down Expand Up @@ -188,7 +185,6 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.
// Resolver selection:
// 1. if it is a PeerID/CID/multihash resolve through "ipns".
// 2. if it is a domain name, resolve through "dns"
// 3. otherwise resolve through the "proquint" resolver

var res resolver
ipnsKey, err := peer.Decode(key)
Expand Down Expand Up @@ -228,11 +224,9 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.
} else if _, ok := dns.IsDomainName(key); ok {
res = ns.dnsResolver
} else {
// TODO: remove proquint?
// dns.IsDomainName(key) will return true for proquint strings,
// so this block is a dead code.
// (alternative is to move this before DNS check)
res = ns.proquintResolver
out <- onceResult{err: fmt.Errorf("invalid IPNS root: %q", key)}
close(out)
return out
}

resCh := res.resolveOnceAsync(ctx, key, options)
Expand Down
34 changes: 0 additions & 34 deletions namesys/proquint.go

This file was deleted.

0 comments on commit b5662a5

Please sign in to comment.