Documentation ¶
Index ¶
- Variables
- func WitContext(ctx context.Context, p2pCtx Context) context.Context
- type Agent
- func (p *Agent) BroadcastOutbound(ctx context.Context, msg proto.Message) (err error)
- func (p *Agent) Info() (peerstore.PeerInfo, error)
- func (p *Agent) Neighbors(ctx context.Context) ([]peerstore.PeerInfo, error)
- func (p *Agent) Self() ([]multiaddr.Multiaddr, error)
- func (p *Agent) Start(ctx context.Context) error
- func (p *Agent) Stop(ctx context.Context) error
- func (p *Agent) UnicastOutbound(ctx context.Context, peer peerstore.PeerInfo, msg proto.Message) (err error)
- type BlockList
- type Context
- type HandleBroadcastInbound
- type HandleUnicastInboundAsync
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAgentNotStarted is the error returned when p2p agent has not been started ErrAgentNotStarted = errors.New("p2p agent has not been started") )
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is the agent to help the blockchain node connect into the P2P networks and send/receive messages
func NewAgent ¶
func NewAgent(cfg config.Config, broadcastHandler HandleBroadcastInbound, unicastHandler HandleUnicastInboundAsync) *Agent
NewAgent instantiates a local P2P agent instance
func (*Agent) BroadcastOutbound ¶
BroadcastOutbound sends a broadcast message to the whole network
type BlockList ¶ added in v1.1.1
type BlockList struct {
// contains filtered or unexported fields
}
BlockList is the struct for blocklist
func NewBlockList ¶ added in v1.1.1
NewBlockList creates an instance of blocklist
type Context ¶
type Context struct {
ChainID uint32
}
Context provides the auxiliary information Agent network operations
type HandleBroadcastInbound ¶
HandleBroadcastInbound handles broadcast message when agent listens it from the network
Click to show internal directories.
Click to hide internal directories.