ipfs

package module
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 14 Imported by: 3

README

IPFS library helpers are wrappers

This submodule contains wrapper implementations of IPFS-stack interfaces to introduce blocking-functionality as provided by NOpfs.

This submodule has its own go.mod and go.sum files and depend on the version of Boxo that we are building it for.

This submodule is tagged in the form ipfs/v<BOXO_VERSION>.<RELEASE_NUMBER> where the Boxo version corresponds to the Boxo release that the code targets and the release suffix to the release number for that version (in case of multiple).

Documentation

Overview

Package ipfs provides wrapper implementations of key layers in the go-ipfs stack to enable content-blocking.

Index

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.

func WrapResolver

func WrapResolver(res resolver.Resolver, blocker *nopfs.Blocker) resolver.Resolver

WrapResolver wraps the given path Resolver 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) AddBlock

func (nbs *BlockService) AddBlock(ctx context.Context, o blocks.Block) error

AddBlock adds a block unless the CID is blocked.

func (*BlockService) AddBlocks

func (nbs *BlockService) AddBlocks(ctx context.Context, bs []blocks.Block) error

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.

func (*BlockService) GetBlock

func (nbs *BlockService) GetBlock(ctx context.Context, c cid.Cid) (blocks.Block, error)

Gets a block unless CID has been blocked.

func (*BlockService) GetBlocks

func (nbs *BlockService) GetBlocks(ctx context.Context, ks []cid.Cid) <-chan blocks.Block

GetsBlocks reads several blocks. Blocked CIDs are filtered out of ks.

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.

func (*Resolver) ResolvePathComponents

func (res *Resolver) ResolvePathComponents(ctx context.Context, fpath path.Path) ([]ipld.Node, error)

ResolvePathComponents checks if the given path is blocked before resolving.

func (*Resolver) ResolveToLastNode

func (res *Resolver) ResolveToLastNode(ctx context.Context, fpath path.Path) (cid.Cid, []string, error)

ResolveToLastNode checks if the given path is blocked before resolving.

Jump to

Keyboard shortcuts

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