node

package
v0.0.0-...-e1b380c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const NodeMessagesQueueSize = 128

NodeMessagesQueueSize is the number of incoming messages to buffer for each topic.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

func NewNode

func NewNode(opts ...NodeOpt) (*Node, error)

func (*Node) Addresses

func (n *Node) Addresses() []string

func (*Node) Broadcast

func (n *Node) Broadcast(data []byte) error

Publish sends a message to the pubsub topic.

func (*Node) Connect

func (n *Node) Connect(address string) error

func (*Node) DumpAddresses

func (n *Node) DumpAddresses()

func (*Node) GetMessages

func (n *Node) GetMessages() chan *pubsub.Message

func (*Node) GetPeers

func (n *Node) GetPeers() []peer.ID

func (*Node) ID

func (n *Node) ID() peer.ID

func (*Node) ListPeers

func (n *Node) ListPeers() []peer.ID

func (*Node) NewStream

func (n *Node) NewStream(p peer.ID, pids protocol.ID) (network.Stream, error)

func (*Node) SetStreamHandler

func (n *Node) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)

func (*Node) Start

func (n *Node) Start(parentCtx context.Context, opts ...pubsub.Option) error

func (*Node) Stop

func (n *Node) Stop()

type NodeOpt

type NodeOpt func(*Node) error

func WithNetworkId

func WithNetworkId(networkId string) NodeOpt

func WithSeed

func WithSeed(seed int64) NodeOpt

Jump to

Keyboard shortcuts

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