Documentation ¶
Index ¶
- type P2PNode
- func (p *P2PNode) AdjustPeerQuality(peer p2p.PeerID, topic string, adjFn func(int) int)
- func (p *P2PNode) BanPeer(peer p2p.PeerID)
- func (p *P2PNode) Broadcast(location common.Location, data interface{}) error
- func (p *P2PNode) Close() error
- func (p *P2PNode) Connect(pi peer.AddrInfo) error
- func (p *P2PNode) GetBandwidthCounter() libp2pmetrics.Reporter
- func (p *P2PNode) GetBlockByNumber(number *big.Int, location common.Location) *types.WorkObject
- func (p *P2PNode) GetBlockHashByNumber(number *big.Int, location common.Location) *common.Hash
- func (p *P2PNode) GetHeight(location common.Location) uint64
- func (p *P2PNode) GetHostBackend() host.Host
- func (p *P2PNode) GetPeerManager() peerManager.PeerManager
- func (p *P2PNode) GetRequestManager() requestManager.RequestManager
- func (p *P2PNode) GetStream(peerID peer.ID) (network.Stream, error)
- func (p *P2PNode) GetWorkObject(hash common.Hash, location common.Location) *types.WorkObject
- func (p *P2PNode) GetWorkObjectsFrom(hash common.Hash, location common.Location, count int) []*types.WorkObjectBlockView
- func (p *P2PNode) ProtectPeer(peer p2p.PeerID)
- func (p *P2PNode) Request(location common.Location, requestData interface{}, ...) chan interface{}
- func (p *P2PNode) SetConsensusBackend(be quai.ConsensusAPI)
- func (p *P2PNode) Start() error
- func (p *P2PNode) Stop() error
- func (p *P2PNode) Subscribe(location common.Location, datatype interface{}) error
- func (p *P2PNode) UnprotectPeer(peer p2p.PeerID)
- func (p *P2PNode) Unsubscribe(location common.Location, datatype interface{}) error
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 ¶
Returns a new libp2p node. The node is created with the given context and options passed as arguments.
func (*P2PNode) AdjustPeerQuality ¶ added in v0.32.0
func (*P2PNode) GetBandwidthCounter ¶ added in v0.31.0
func (p *P2PNode) GetBandwidthCounter() libp2pmetrics.Reporter
func (*P2PNode) GetBlockByNumber ¶ added in v0.31.0
func (*P2PNode) GetBlockHashByNumber ¶
func (*P2PNode) GetHostBackend ¶
func (*P2PNode) GetPeerManager ¶
func (p *P2PNode) GetPeerManager() peerManager.PeerManager
func (*P2PNode) GetRequestManager ¶
func (p *P2PNode) GetRequestManager() requestManager.RequestManager
func (*P2PNode) GetStream ¶ added in v0.30.0
Opens a new stream to the given peer using the given protocol ID
func (*P2PNode) GetWorkObject ¶
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) GetWorkObjectsFrom ¶ added in v0.31.0
func (p *P2PNode) GetWorkObjectsFrom(hash common.Hash, location common.Location, count int) []*types.WorkObjectBlockView
Search for the block in the data base and get the count number of the next blocks
func (*P2PNode) ProtectPeer ¶
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) UnprotectPeer ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.