ipfs

package
v0.0.0-...-d0512a4 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

this package contains ipfs helper functions

this package contains ipfs helper functions

this package contains ipfs helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBytes

func AddBytes(node iface.CoreAPI, msg []byte) (cid.Cid, error)

func AddFsFile

func AddFsFile(node iface.CoreAPI, path string) (path.Resolved, error)

Adds a file (or a directory) from the local filesystem to IPFS

func AddProtobufFile

func AddProtobufFile(node iface.CoreAPI, msg proto.Message) (cid.Cid, error)

Adds a file from a protobuf slice to IPFS

func DecryptSecret

func DecryptSecret(secret *pb.Volume_SecretConfig, contents []byte) ([]byte, error)

func DownloadSecret

func DownloadSecret(ctx context.Context, ipfs iface.CoreAPI, secret *pb.Volume_SecretConfig) ([]byte, error)

func EncryptSecret

func EncryptSecret(data []byte) (key *pb.Key, contents []byte, err error)

func GetBytes

func GetBytes(node iface.CoreAPI, cid cid.Cid) ([]byte, error)

func GetFsFile

func GetFsFile(node iface.CoreAPI, file files.Node, path path.Path, savePath string) error

Saves an IPFS file or directory represented by the given files.Node to the specified local file system path.

func GetImageRef

func GetImageRef(ctx context.Context, sys *types.SystemContext, image *pb.Container_Image) (imageRef types.ImageReference, digest string, err error)

func GetIpfsClient

func GetIpfsClient(ipfsApi string) (api *rpc.HttpApi, apiMultiaddr multiaddr.Multiaddr, err error)

func GetProtobufFile

func GetProtobufFile(node iface.CoreAPI, cid cid.Cid, msg proto.Message) error

func GetRefUrl

func GetRefUrl(imageRef types.ImageReference) string

func ReadSecret

func ReadSecret(basepath string, secret *pb.Volume_SecretConfig) ([]byte, error)

func RemoveSecret

func RemoveSecret(ctx context.Context, ipfs iface.CoreAPI, cidBytes []byte) error

func ReuploadImageFromIpdr

func ReuploadImageFromIpdr(ctx context.Context, ipfs iface.CoreAPI, localRegistryUrl string, sys *types.SystemContext, image *pb.Container_Image) (types.ImageReference, error)

func TransformSecrets

func TransformSecrets(pod *pb.Pod, transformations ...SecretTransformation) error

func UploadImageToIpdr

func UploadImageToIpdr(ctx context.Context, ipfs iface.CoreAPI, sys *types.SystemContext, imageRef types.ImageReference) (key *pb.Key, imageCid []byte, err error)

func UploadSecret

func UploadSecret(ctx context.Context, ipfs iface.CoreAPI, contents []byte) (cid []byte, err error)

Types

type ExistingOption

type ExistingOption int
const (
	ConflictExistingEndpoint ExistingOption = 0
	ReturnExistingEndpoint   ExistingOption = 1
)

type ExposedEndpoint

type ExposedEndpoint struct {
	P2PListenerInfoOutput
	// contains filtered or unexported fields
}

func (*ExposedEndpoint) Close

func (i *ExposedEndpoint) Close() error

type ForwardedConnection

type ForwardedConnection struct {
	P2PListenerInfoOutput
	// contains filtered or unexported fields
}

func (*ForwardedConnection) Close

func (f *ForwardedConnection) Close() error

type IpfsAddr

type IpfsAddr struct {
	net.Addr
	*ForwardedConnection
}

type IpfsListener

type IpfsListener struct {
	net.Listener
	*ExposedEndpoint
}

func (*IpfsListener) Close

func (l *IpfsListener) Close() error

type P2PListenerInfoOutput

type P2PListenerInfoOutput struct {
	Protocol      string
	ListenAddress string
	TargetAddress string
}

type P2PLsOutput

type P2PLsOutput struct {
	Listeners []P2PListenerInfoOutput
}

type P2pApi

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

func NewP2pApi

func NewP2pApi(http *rpc.HttpApi, nodeAddr multiaddr.Multiaddr) *P2pApi

func (*P2pApi) Connect

func (api *P2pApi) Connect(protocol string, target multiaddr.Multiaddr) (*IpfsAddr, error)

func (*P2pApi) ConnectTo

func (api *P2pApi) ConnectTo(protocol string, target peer.ID) (*IpfsAddr, error)

func (*P2pApi) ExposeEndpoint

func (api *P2pApi) ExposeEndpoint(protocol string, endpoint multiaddr.Multiaddr, existing ExistingOption) (*ExposedEndpoint, error)

func (*P2pApi) ForwardConnection

func (api *P2pApi) ForwardConnection(protocol string, endpoint multiaddr.Multiaddr, target multiaddr.Multiaddr) (*ForwardedConnection, error)

func (*P2pApi) Listen

func (api *P2pApi) Listen(protocol string) (*IpfsListener, error)

type SecretTransformation

type SecretTransformation func(secret *pb.Volume_SecretConfig) error

Jump to

Keyboard shortcuts

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