node

package
v0.0.0-...-12a9a0b Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Sk             bccsp.Key
	Self           *proto.RemotePeer
	BootstrapPeers []*proto.RemotePeer
	Notaries       []*proto.RemotePeer
	TimeoutRPC     time.Duration
	KeyImportOpts  bccsp.KeyImportOpts
	HashOpts       bccsp.HashOpts
	SignerOpts     bccsp.SignerOpts
}

func NewConfig

func NewConfig(sk bccsp.Key, self *proto.RemotePeer, bootstrapPeers []*proto.RemotePeer, notaries []*proto.RemotePeer, timeoutRPC time.Duration,
	keyImportOpts bccsp.KeyImportOpts, hashOpts bccsp.HashOpts, signerOpts bccsp.SignerOpts,
) *Config

type Node

type Node struct {
	notary.NotaryManager
	// contains filtered or unexported fields
}

func New

func New(config *Config, server *rpc.Server, mcs crypto.MessageCryptoService) *Node

func (*Node) GetDiscovery

func (n *Node) GetDiscovery() discovery.Discovery

GetDiscovery

@Description: get the discovery

func (*Node) Lookup

func (n *Node) Lookup(pk []byte) *proto.RemotePeer

func (*Node) Peers

func (n *Node) Peers() []*proto.RemotePeer

Peers

@Description: get the peers discovered in the network
@return *proto.RemotePeer

func (*Node) RegisterListener

func (n *Node) RegisterListener(content any, listener comm.MessageListener)

RegisterListener

@Description: register listener to node

func (*Node) Self

func (n *Node) Self() *proto.RemotePeer

func (*Node) SendToPeers

func (n *Node) SendToPeers(msg *proto.Message, peers ...*proto.RemotePeer)

func (*Node) SendWithFilter

func (n *Node) SendWithFilter(msg *proto.Message, filter PeerFilter)

SendWithFilter

@Description: send msg to peers filtered by filter
@param msg
@param filter
@return error

func (*Node) SignMessage

func (n *Node) SignMessage(message *proto.Message) (*proto.Envelope[*proto.Message], error)

func (*Node) Stop

func (n *Node) Stop()

Stop stops the gossip component

type PeerFilter

type PeerFilter func(peer *proto.RemotePeer) bool

Jump to

Keyboard shortcuts

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