Documentation
¶
Overview ¶
Package namesys defines Resolver and Publisher interfaces for IPNS paths, that is, IPFS 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).
Additionally, the /ipns/ namespace can also be used with domain names that use DNSLink (/ipns/<dnslink_name>, https://docs.ipfs.io/concepts/dnslink/)
The package provides implementations for all three resolvers.
Index ¶
- Constants
- Variables
- func IpnsDsKey(id peer.ID) ds.Keydeprecated
- func PkKeyForID(id peer.ID) stringdeprecated
- func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec *pb.IpnsEntry) errordeprecated
- func PublishPublicKey(ctx context.Context, r routing.ValueStore, k string, pubk crypto.PubKey) errordeprecated
- func PutRecordToRouting(ctx context.Context, r routing.ValueStore, k crypto.PubKey, ...) errordeprecated
- func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)deprecated
- type DNSResolverdeprecated
- type IpnsPublisherdeprecated
- func (p *IpnsPublisher) GetPublished(ctx context.Context, id peer.ID, checkRouting bool) (*pb.IpnsEntry, error)
- func (p *IpnsPublisher) ListPublished(ctx context.Context) (map[peer.ID]*pb.IpnsEntry, error)
- func (p *IpnsPublisher) Publish(ctx context.Context, k crypto.PrivKey, value path.Path, ...) error
- type IpnsResolverdeprecated
- type LookupTXTFuncdeprecated
- type NameSystemdeprecated
- type Optiondeprecated
- func WithCache(size int) Optiondeprecated
- func WithDNSResolver(rslv madns.BasicResolver) Optiondeprecated
- func WithDatastore(ds ds.Datastore) Optiondeprecated
- type Publisherdeprecated
- type Resolverdeprecated
- type Resultdeprecated
Constants ¶
const DefaultResolverCacheTTL = time.Minute
DefaultResolverCacheTTL defines max ttl of a record placed in namesys cache.
Deprecated: use github.com/ipfs/boxo/namesys.DefaultResolverCacheTTL
Variables ¶
var ErrPublishFailed = errors.New("could not publish name")
ErrPublishFailed signals an error when attempting to publish.
Deprecated: use github.com/ipfs/boxo/namesys.ErrPublishFailed
var ErrResolveFailed = errors.New("could not resolve name")
ErrResolveFailed signals an error when attempting to resolve.
Deprecated: use github.com/ipfs/boxo/namesys.ErrResolveFailed
var ErrResolveRecursion = errors.New(
"could not resolve name (recursion limit exceeded)")
ErrResolveRecursion signals a recursion-depth limit.
Deprecated: use github.com/ipfs/boxo/namesys.ErrResolveRecursion
Functions ¶
func PkKeyForID
deprecated
func PublishEntry
deprecated
func PublishPublicKey
deprecated
func PutRecordToRouting
deprecated
func PutRecordToRouting(ctx context.Context, r routing.ValueStore, k crypto.PubKey, entry *pb.IpnsEntry) error
PutRecordToRouting publishes the given entry using the provided ValueStore, keyed on the ID associated with the provided public key. The public key is also made available to the routing system so that entries can be verified.
Deprecated: use github.com/ipfs/boxo/namesys.PutRecordToRouting
Types ¶
type DNSResolver
deprecated
type DNSResolver struct {
// contains filtered or unexported fields
}
DNSResolver implements a Resolver on DNS domains
Deprecated: use github.com/ipfs/boxo/namesys.DNSResolver
func NewDNSResolver
deprecated
func NewDNSResolver(lookup LookupTXTFunc) *DNSResolver
NewDNSResolver constructs a name resolver using DNS TXT records.
Deprecated: use github.com/ipfs/boxo/namesys.NewDNSResolver
func (*DNSResolver) Resolve ¶
func (r *DNSResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error)
Resolve implements Resolver.
func (*DNSResolver) ResolveAsync ¶
func (r *DNSResolver) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result
ResolveAsync implements Resolver.
type IpnsPublisher
deprecated
type IpnsPublisher struct {
// contains filtered or unexported fields
}
IpnsPublisher is capable of publishing and resolving names to the IPFS routing system.
Deprecated: use github.com/ipfs/boxo/namesys.IpnsPublisher
func NewIpnsPublisher
deprecated
func NewIpnsPublisher(route routing.ValueStore, ds ds.Datastore) *IpnsPublisher
NewIpnsPublisher constructs a publisher for the IPFS Routing name system.
Deprecated: use github.com/ipfs/boxo/namesys.NewIpnsPublisher
func (*IpnsPublisher) GetPublished ¶
func (p *IpnsPublisher) GetPublished(ctx context.Context, id peer.ID, checkRouting bool) (*pb.IpnsEntry, error)
GetPublished returns the record this node has published corresponding to the given peer ID.
If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
func (*IpnsPublisher) ListPublished ¶
ListPublished returns the latest IPNS records published by this node and their expiration times.
This method will not search the routing system for records published by other nodes.
func (*IpnsPublisher) Publish ¶
func (p *IpnsPublisher) Publish(ctx context.Context, k crypto.PrivKey, value path.Path, options ...opts.PublishOption) error
Publish implements Publisher. Accepts a keypair and a value, and publishes it out to the routing system
type IpnsResolver
deprecated
type IpnsResolver struct {
// contains filtered or unexported fields
}
IpnsResolver implements NSResolver for the main IPFS SFS-like naming
Deprecated: use github.com/ipfs/boxo/namesys.IpnsResolver
func NewIpnsResolver
deprecated
func NewIpnsResolver(route routing.ValueStore) *IpnsResolver
NewIpnsResolver constructs a name resolver using the IPFS Routing system to implement SFS-like naming on top.
Deprecated: use github.com/ipfs/boxo/namesys.NewIpnsResolver
func (*IpnsResolver) Resolve ¶
func (r *IpnsResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error)
Resolve implements Resolver.
func (*IpnsResolver) ResolveAsync ¶
func (r *IpnsResolver) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result
ResolveAsync implements Resolver.
type NameSystem
deprecated
NameSystem represents a cohesive name publishing and resolving system.
Publishing a name is the process of establishing a mapping, a key-value pair, according to naming rules and databases.
Resolving a name is the process of looking up the value associated with the key (name).
Deprecated: use github.com/ipfs/boxo/namesys.NameSystem
func NewNameSystem
deprecated
func NewNameSystem(r routing.ValueStore, opts ...Option) (NameSystem, error)
NewNameSystem will construct the IPFS naming system based on Routing
Deprecated: use github.com/ipfs/boxo/namesys.NewNameSystem
type Option
deprecated
added in
v0.2.0
type Option func(*mpns) error
Deprecated: use github.com/ipfs/boxo/namesys.Option
func WithDNSResolver
deprecated
added in
v0.2.0
func WithDNSResolver(rslv madns.BasicResolver) Option
WithDNSResolver is an option that supplies a custom DNS resolver to use instead of the system default.
Deprecated: use github.com/ipfs/boxo/namesys.WithDNSResolver
func WithDatastore
deprecated
added in
v0.2.0
type Publisher
deprecated
type Publisher interface { // Publish establishes a name-value mapping. // TODO make this not PrivKey specific. Publish(ctx context.Context, name ci.PrivKey, value path.Path, options ...opts.PublishOption) error }
Publisher is an object capable of publishing particular names.
Deprecated: use github.com/ipfs/boxo/namesys.Publisher
type Resolver
deprecated
type Resolver interface { // Resolve performs a recursive lookup, returning the dereferenced // path. For example, if ipfs.io has a DNS TXT record pointing to // /ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy // and there is a DHT IPNS entry for // QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy // -> /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj // then // Resolve(ctx, "/ipns/ipfs.io") // will resolve both names, returning // /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj // // There is a default depth-limit to avoid infinite recursion. Most // users will be fine with this default limit, but if you need to // adjust the limit you can specify it as an option. Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (value path.Path, err error) // ResolveAsync performs recursive name lookup, like Resolve, but it returns // entries as they are discovered in the DHT. Each returned result is guaranteed // to be "better" (which usually means newer) than the previous one. ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result }
Resolver is an object capable of resolving names.
Deprecated: use github.com/ipfs/boxo/namesys.Resolver
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package republisher provides a utility to automatically re-publish IPNS records related to the keys in a Keystore.
|
Package republisher provides a utility to automatically re-publish IPNS records related to the keys in a Keystore. |