node

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2PNode

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

P2PNode represents a libp2p node

func NewNode

func NewNode(ctx context.Context, quitCh chan struct{}) (*P2PNode, error)

Returns a new libp2p node. The node is created with the given context and options passed as arguments.

func (*P2PNode) BanPeer

func (p *P2PNode) BanPeer(peer p2p.PeerID)

func (*P2PNode) Broadcast

func (p *P2PNode) Broadcast(location common.Location, data interface{}) error

func (*P2PNode) Connect

func (p *P2PNode) Connect(pi peer.AddrInfo) error

Connects to the given peer

func (*P2PNode) GetBlockHashByNumber

func (p *P2PNode) GetBlockHashByNumber(number *big.Int, location common.Location) *common.Hash

func (*P2PNode) GetBootPeers

func (p *P2PNode) GetBootPeers() []peer.AddrInfo

Returns the list of bootpeers

func (*P2PNode) GetHeader

func (p *P2PNode) GetHeader(hash common.Hash, location common.Location) *types.WorkObject

func (*P2PNode) GetHostBackend

func (p *P2PNode) GetHostBackend() host.Host

func (*P2PNode) GetPeerManager

func (p *P2PNode) GetPeerManager() peerManager.PeerManager

func (*P2PNode) GetRequestManager

func (p *P2PNode) GetRequestManager() requestManager.RequestManager

func (*P2PNode) GetTrieNode

func (p *P2PNode) GetTrieNode(hash common.Hash, location common.Location) *trie.TrieNodeResponse

func (*P2PNode) GetWorkObject

func (p *P2PNode) GetWorkObject(hash common.Hash, location common.Location) *types.WorkObject

Search for a block in the node's cache, or query the consensus backend if it's not found in cache. Returns nil if the block is not found.

func (*P2PNode) MarkLatentPeer

func (p *P2PNode) MarkLatentPeer(peer p2p.PeerID, topic string)

func (*P2PNode) MarkLivelyPeer

func (p *P2PNode) MarkLivelyPeer(peer p2p.PeerID, topic string)

func (*P2PNode) NewStream

func (p *P2PNode) NewStream(peerID peer.ID) (network.Stream, error)

Opens a new stream to the given peer using the given protocol ID

func (*P2PNode) ProtectPeer

func (p *P2PNode) ProtectPeer(peer p2p.PeerID)

func (*P2PNode) Request

func (p *P2PNode) Request(location common.Location, requestData interface{}, responseDataType interface{}) chan interface{}

Request a data from the network for the specified slice

func (*P2PNode) SetConsensusBackend

func (p *P2PNode) SetConsensusBackend(be quai.ConsensusAPI)

func (*P2PNode) Start

func (p *P2PNode) Start() error

Starts the node and all of its services

func (*P2PNode) Stop

func (p *P2PNode) Stop() error

Function to gracefully shtudown all running services

func (*P2PNode) Subscribe

func (p *P2PNode) Subscribe(location common.Location, datatype interface{}) error

func (*P2PNode) UnprotectPeer

func (p *P2PNode) UnprotectPeer(peer p2p.PeerID)

func (*P2PNode) Unsubscribe

func (p *P2PNode) Unsubscribe(location common.Location, datatype interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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