Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
refactor: remove proquint.go
Browse files Browse the repository at this point in the history
See discussion in:
#13 (review)
  • Loading branch information
lidel authored and vyzo committed Apr 23, 2021
1 parent 2ae3bae commit aa54bc9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 50 deletions.
4 changes: 2 additions & 2 deletions 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
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module github.com/ipfs/go-namesys

require (
github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d
github.com/gogo/protobuf v1.3.2
github.com/hashicorp/golang-lru v0.5.4
github.com/ipfs/go-cid v0.0.7
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d h1:QgeLLoPD3kRVmeu/1al9iIpIANMi9O1zXFm8BnYGCJg=
github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d/go.mod h1:Jbj8eKecMNwf0KFI75skSUZqMB4UCRcndUScVBTWyUI=
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
Expand Down
16 changes: 5 additions & 11 deletions 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 proquint.go

This file was deleted.

0 comments on commit aa54bc9

Please sign in to comment.