namesys

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2015 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

package namesys implements various functionality for the ipns naming system.

Index

Constants

This section is empty.

Variables

View Source
var ErrExpiredRecord = errors.New("expired record")

ErrExpiredRecord should be returned when an ipns record is invalid due to being too old

View Source
var ErrPublishFailed = errors.New("could not publish name.")

ErrPublishFailed signals an error when attempting to publish.

View Source
var ErrResolveFailed = errors.New("could not resolve name.")

ErrResolveFailed signals an error when attempting to resolve.

View Source
var ErrUnrecognizedValidity = errors.New("unrecognized validity type")

ErrUnrecognizedValidity is returned when an IpnsRecord has an unknown validity type.

View Source
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

func (*DNSResolver) Resolve

func (r *DNSResolver) Resolve(ctx context.Context, name string) (u.Key, error)

Resolve implements Resolver TXT records for a given domain name should contain a b58 encoded multihash.

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.

func (*ProquintResolver) Resolve

func (r *ProquintResolver) Resolve(ctx context.Context, name string) (u.Key, error)

Resolve implements Resolver. Decodes the 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.

Directories

Path Synopsis
internal
pb
Package namesys_pb is a generated protocol buffer package.
Package namesys_pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL