pkg

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPeersConnected is returned if there is no peer connected
	ErrNoPeersConnected = errors.New("no Peers connected")

	// ErrNoPeerAddress re returned if peer address is not available
	ErrNoPeerAddress = errors.New("could not get peer address")
)

Functions

func CheckError

func CheckError(log *logging.ZapEventLogger, f func() error)

func CheckErrors

func CheckErrors(fs ...func() error)

func Init

func Init(root, port string) error

Types

type Common

type Common struct {
	Repo    repo.Repo
	Context context.Context

	Node       Node
	Encryption Encryption
	// contains filtered or unexported fields
}

Common features for cli commands

func New

func New(ctx context.Context, root, port string, en Encryption) (*Common, error)

func (*Common) GetPort

func (comm *Common) GetPort() string

func (*Common) GetRoot

func (comm *Common) GetRoot() string

func (*Common) Start

func (comm *Common) Start(key string, autoDownload bool) (<-chan struct{}, error)

func (*Common) Stop

func (comm *Common) Stop()

type Encryption added in v0.0.14

type Encryption interface {
	EncryptContent([]byte, string) ([]byte, error)
	DecryptContent([]byte, string) ([]byte, error)
}

type Node

type Node interface {
	Stop()
	NetworkNotifiee(network.Notifiee)
	Bootstrap([]peer.AddrInfo)
	NewFloodsubWithProtocols([]protocol.ID, ...pubsub.Option) (*pubsub.PubSub, error)
	Peers() []string
	Connect(peer.AddrInfo) error
	AddrInfo() *peer.AddrInfo
	IsOnline() bool
	ReplManager() *replication.Manager
	IsPeerConnected(string) bool
	GetPrivKey() crypto.PrivKey
	GetPubKey(id peer.ID) crypto.PubKey

	store.Store
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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