peer

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent string = "Taubyte Node v1.0"

Variables

View Source
var MaxBootstrapNodes = 5
View Source
var PingTimeout = time.Second * 4

Functions

func IpfsSTyleAddrsFactory

func IpfsSTyleAddrsFactory(announce []string, noAnnounce []string) libp2p.Option

Types

type BootstrapParams

type BootstrapParams struct {
	Enable bool
	Peers  []peer.AddrInfo
}

func Bootstrap

func Bootstrap(peers ...peer.AddrInfo) BootstrapParams

func StandAlone

func StandAlone() BootstrapParams

type Node

type Node interface {
	AddFile(r io.Reader) (string, error)
	AddFileForCid(r io.Reader) (cid.Cid, error)
	Close()
	Context() context.Context
	DAG() *ipfslite.Peer
	DeleteFile(id string) error
	Discovery() discovery.Discovery
	Done() <-chan struct{}
	GetFile(ctx context.Context, id string) (ReadSeekCloser, error)
	GetFileFromCid(ctx context.Context, cid cid.Cid) (ReadSeekCloser, error)
	ID() peer.ID
	Messaging() *pubsub.PubSub
	NewChildContextWithCancel() (context.Context, context.CancelFunc)
	NewFolder(name string) (dir.Directory, error)
	NewPubSubKeepAlive(ctx context.Context, cancel context.CancelFunc, name string) error
	Peer() host.Host
	Peering() PeeringService
	Ping(pid string, count int) (int, time.Duration, error)
	PubSubPublish(ctx context.Context, name string, data []byte) error
	PubSubSubscribe(name string, handler PubSubConsumerHandler, err_handler PubSubConsumerErrorHandler) error
	PubSubSubscribeContext(ctx context.Context, name string, handler PubSubConsumerHandler, err_handler PubSubConsumerErrorHandler) error
	PubSubSubscribeToTopic(topic *pubsub.Topic, handler PubSubConsumerHandler, err_handler PubSubConsumerErrorHandler) error
	SimpleAddrsFactory(announce []string, override bool) config.Option
	Store() datastore.Batching
	WaitForSwarm(timeout time.Duration) error
}

func MockNode

func MockNode(ctx context.Context) Node

func New

func New(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, notPublic bool, bootstrap bool) (Node, error)

func NewClientNode

func NewClientNode(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, notPublic bool, bootstrapers []peer.AddrInfo) (Node, error)

func NewFull

func NewFull(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, isPublic bool, bootstrap BootstrapParams) (Node, error)

func NewLitePublic

func NewLitePublic(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, bootstrap BootstrapParams) (Node, error)

func NewPublic

func NewPublic(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, bootstrap BootstrapParams) (Node, error)

func NewWithBootstrapList

func NewWithBootstrapList(ctx context.Context, repoPath interface{}, privateKey []byte, swarmKey []byte, swarmListen []string, swarmAnnounce []string, notPublic bool, bootstrapers []peer.AddrInfo) (Node, error)

type PeeringService

type PeeringService interface {
	Start() error
	Stop() error
	AddPeer(peer.AddrInfo)
	RemovePeer(peer.ID)
}

func NewPeeringService

func NewPeeringService(node *node) PeeringService

NewPeeringService constructs a new peering service. Peers can be added and removed immediately, but connections won't be formed until `Start` is called.

type PubSubConsumerErrorHandler

type PubSubConsumerErrorHandler func(err error)

type PubSubConsumerHandler

type PubSubConsumerHandler func(msg *pubsub.Message)

type ReadSeekCloser

type ReadSeekCloser interface {
	io.ReadSeekCloser
	io.WriterTo
}

Jump to

Keyboard shortcuts

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