ipfs

package
v0.0.0-...-ada256f Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIURL      string            // URL of an IPFS API endpoint (for Ls and Stat calls).
	GatewayURL  string            // URL of an IPFS Gateway (to request content).
	PartialSize datasize.ByteSize // Filesize of items which are being considered partials (chunks).
}

Config specifies the configuration for the IPFS protocol.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for a Sniffer.

type IPFS

type IPFS struct {
	*instr.Instrumentation
	// contains filtered or unexported fields
}

IPFS implements the Protocol interface for the Interplanery Filesystem. It is concurrency-safe.

func New

func New(config *Config, client *http.Client, instr *instr.Instrumentation) *IPFS

New returns a new IPFS protocol.

func (*IPFS) GatewayURL

func (i *IPFS) GatewayURL(r *t.AnnotatedResource) string

GatewayURL returns the URL to request a resource from the gateway. If a reference is available, it is used to generate the filename to facilitate content type detection (e.g. /ipfs/<parent_hash>/my_file.jpg instead of /ipfs/<file_hash>/). Ref: http://docs.ipfs.io.ipns.localhost:8080/concepts/ipfs-gateway/#gateway-types

func (*IPFS) Ls

func (i *IPFS) Ls(ctx context.Context, r *t.AnnotatedResource, out chan<- *t.AnnotatedResource) error

Ls returns a channel with AnnotatedResource's with Type and Size populated.

func (*IPFS) Stat

func (i *IPFS) Stat(ctx context.Context, r *t.AnnotatedResource) error

Stat returns a AnnotatedResource with Type and Size populated. Ref: http://docs.ipfs.io.ipns.localhost:8080/reference/http/api/#api-v0-files-stat

Jump to

Keyboard shortcuts

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