Documentation
¶
Overview ¶
package namesys implements various functionality for the ipns naming system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExpiredRecord = errors.New("expired record")
ErrExpiredRecord should be returned when an ipns record is invalid due to being too old
var ErrPublishFailed = errors.New("could not publish name.")
ErrPublishFailed signals an error when attempting to publish.
var ErrResolveFailed = errors.New("could not resolve name.")
ErrResolveFailed signals an error when attempting to resolve.
var ErrUnrecognizedValidity = errors.New("unrecognized validity type")
ErrUnrecognizedValidity is returned when an IpnsRecord has an unknown validity type.
var IpnsRecordValidator = &record.ValidChecker{
Func: ValidateIpnsRecord,
Sign: true,
}
Functions ¶
func InitializeKeyspace ¶ added in v0.3.2
func InitializeKeyspace(ctx context.Context, ds dag.DAGService, pub Publisher, pins pin.Pinner, key ci.PrivKey) error
InitializeKeyspace sets the ipns record for the given key to point to an empty directory. TODO: this doesnt feel like it belongs here
func ValidateIpnsRecord ¶
func ValidateIpnsRecord(k u.Key, val []byte) error
ValidateIpnsRecord implements ValidatorFunc and verifies that the given 'val' is an IpnsEntry and that that entry is valid.
Types ¶
type DNSResolver ¶
type DNSResolver struct {
}
DNSResolver implements a Resolver on DNS domains
func (*DNSResolver) CanResolve ¶
func (r *DNSResolver) CanResolve(name string) bool
CanResolve implements Resolver
type NameSystem ¶
type NameSystem interface {
Resolver
Publisher
}
Namesys 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).
func NewNameSystem ¶
func NewNameSystem(r routing.IpfsRouting) NameSystem
NewNameSystem will construct the IPFS naming system based on Routing
type ProquintResolver ¶
type ProquintResolver struct{}
func (*ProquintResolver) CanResolve ¶
func (r *ProquintResolver) CanResolve(name string) bool
CanResolve implements Resolver. Checks whether the name is a proquint string.
type Publisher ¶
type Publisher interface {
// Publish establishes a name-value mapping.
// TODO make this not PrivKey specific.
Publish(ctx context.Context, name ci.PrivKey, value u.Key) error
}
Publisher is an object capable of publishing particular names.
func NewRoutingPublisher ¶
func NewRoutingPublisher(route routing.IpfsRouting) Publisher
NewRoutingPublisher constructs a publisher for the IPFS Routing name system.
type Resolver ¶
type Resolver interface {
// Resolve looks up a name, and returns the value previously published.
Resolve(ctx context.Context, name string) (value u.Key, err error)
// CanResolve checks whether this Resolver can resolve a name
CanResolve(name string) bool
}
Resolver is an object capable of resolving names.
func NewRoutingResolver ¶
func NewRoutingResolver(route routing.IpfsRouting) Resolver
NewRoutingResolver constructs a name resolver using the IPFS Routing system to implement SFS-like naming on top.