verifiedcar

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMalformedCar    = errors.New("malformed CAR")
	ErrBadVersion      = errors.New("bad CAR version")
	ErrBadRoots        = errors.New("CAR root CID mismatch")
	ErrUnexpectedBlock = errors.New("unexpected block in CAR")
	ErrExtraneousBlock = errors.New("extraneous block in CAR")
	ErrMissingBlock    = errors.New("missing block in CAR")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Root       cid.Cid           // The single root we expect to appear in the CAR and that we use to run our traversal against
	AllowCARv2 bool              // If true, allow CARv2 files to be received, otherwise strictly only allow CARv1
	Selector   selector.Selector // The selector to execute, starting at the provided Root, to verify the contents of the CAR
}

func (Config) Verify

func (cfg Config) Verify(ctx context.Context, rdr io.Reader, lsys linking.LinkSystem) (uint64, uint64, error)

Verify reads a CAR from the provided reader, verifies the contents are strictly what is specified by this Config and writes the blocks to the provided BlockWriteOpener. It returns the number of blocks and bytes written to the BlockWriteOpener.

Verification is performed according to the CAR construction rules contained within the Trustless, and Path Gateway specifications:

* https://specs.ipfs.tech/http-gateways/trustless-gateway/

* https://specs.ipfs.tech/http-gateways/path-gateway/

Jump to

Keyboard shortcuts

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