Documentation ¶
Overview ¶
Package ipfs provides wrapper implementations of key layers in the go-ipfs stack to enable content-blocking.
Index ¶
- func WrapBlockService(bs blockservice.BlockService, blocker *nopfs.Blocker) blockservice.BlockService
- func WrapNameSystem(ns namesys.NameSystem, blocker *nopfs.Blocker) namesys.NameSystem
- func WrapResolver(res resolver.Resolver, blocker *nopfs.Blocker) resolver.Resolver
- type BlockService
- func (nbs *BlockService) AddBlock(ctx context.Context, o blocks.Block) error
- func (nbs *BlockService) AddBlocks(ctx context.Context, bs []blocks.Block) error
- func (nbs *BlockService) Blockstore() blockstore.Blockstore
- func (nbs *BlockService) Close() error
- func (nbs *BlockService) DeleteBlock(ctx context.Context, o cid.Cid) error
- func (nbs *BlockService) Exchange() exchange.Interface
- func (nbs *BlockService) GetBlock(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (nbs *BlockService) GetBlocks(ctx context.Context, ks []cid.Cid) <-chan blocks.Block
- type NameSystem
- func (ns *NameSystem) Publish(ctx context.Context, name crypto.PrivKey, value path.Path, ...) error
- func (ns *NameSystem) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error)
- func (ns *NameSystem) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan namesys.Result
- type Resolver
- func (res *Resolver) ResolvePath(ctx context.Context, fpath path.Path) (ipld.Node, ipld.Link, error)
- func (res *Resolver) ResolvePathComponents(ctx context.Context, fpath path.Path) ([]ipld.Node, error)
- func (res *Resolver) ResolveToLastNode(ctx context.Context, fpath path.Path) (cid.Cid, []string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapBlockService ¶
func WrapBlockService(bs blockservice.BlockService, blocker *nopfs.Blocker) blockservice.BlockService
WrapBlockService wraps the given BlockService with a content-blocking layer for Get and Add operations.
func WrapNameSystem ¶
func WrapNameSystem(ns namesys.NameSystem, blocker *nopfs.Blocker) namesys.NameSystem
WrapNameSystem wraps the given NameSystem with a content-blocking layer for Resolve operations.
Types ¶
type BlockService ¶
type BlockService struct {
// contains filtered or unexported fields
}
BlockService implements a blocking BlockService.
func (*BlockService) AddBlocks ¶
AddBlocks adds multiple blocks. Blocks with blocked CIDs are dropped.
func (*BlockService) Blockstore ¶
func (nbs *BlockService) Blockstore() blockstore.Blockstore
Blockstore returns the underlying Blockstore.
func (*BlockService) Close ¶
func (nbs *BlockService) Close() error
Closes the BlockService and the Blocker.
func (*BlockService) DeleteBlock ¶
func (nbs *BlockService) DeleteBlock(ctx context.Context, o cid.Cid) error
DeleteBlock deletes a block.
func (*BlockService) Exchange ¶
func (nbs *BlockService) Exchange() exchange.Interface
Exchange returns the underlying Exchange.
type NameSystem ¶
type NameSystem struct {
// contains filtered or unexported fields
}
NameSystem implements a blocking namesys.NameSystem implementation.
func (*NameSystem) Publish ¶
func (ns *NameSystem) Publish(ctx context.Context, name crypto.PrivKey, value path.Path, options ...opts.PublishOption) error
Publish publishes an IPNS record.
func (*NameSystem) Resolve ¶
func (ns *NameSystem) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error)
Resolve resolves an IPNS name unless it is blocked.
func (*NameSystem) ResolveAsync ¶
func (ns *NameSystem) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan namesys.Result
ResolveAsync resolves an IPNS name asynchronously unless it is blocked.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver implements a blocking path.Resolver.
func (*Resolver) ResolvePath ¶
func (res *Resolver) ResolvePath(ctx context.Context, fpath path.Path) (ipld.Node, ipld.Link, error)
ResolvePath checks if the given path is blocked before resolving.