ipfs

package
v0.0.0-...-a092f05 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndpoint = errs.Class("ipfs endpoint")

ErrEndpoint - ipfs endpoint error class.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address string `help:"IPFS multiaddress of the IPFS node" releaseDefault:"" devDefault:""`
}

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

architecture: Endpoint

func NewEndpoint

func NewEndpoint(log *zap.Logger, service *Service) *Endpoint

NewEndpoint creates new ipfs endpoint instance.

func (*Endpoint) Peers

func (endpoint *Endpoint) Peers(w http.ResponseWriter, r *http.Request)

Peers endpoint retrieves all the active Peers

func (*Endpoint) Pinned

func (endpoint *Endpoint) Pinned(writer http.ResponseWriter, request *http.Request)

func (*Endpoint) Register

func (endpoint *Endpoint) Register(router *mux.Router)

Register registers endpoint methods on API server subroute.

func (*Endpoint) Upload

func (endpoint *Endpoint) Upload(writer http.ResponseWriter, r *http.Request)

type Peer

type Peer struct {
	ID      string
	Address string
}

type Pinned

type Pinned struct {
	CID  string
	Size uint64
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service for IPFS related operations.

architecture: Service

func NewService

func NewService(log *zap.Logger, address string) (*Service, error)

func (*Service) GetPeers

func (s *Service) GetPeers(ctx context.Context) ([]Peer, error)

func (*Service) IsPinned

func (s *Service) IsPinned(ctx context.Context, CID string) (res bool, err error)

func (*Service) Pin

func (s *Service) Pin(ctx context.Context, CID string) (res Pinned, err error)

func (*Service) Upload

func (s *Service) Upload(ctx context.Context, reader io.Reader) (string, error)

Jump to

Keyboard shortcuts

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