Documentation ¶
Index ¶
- 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
- func (p *Agent) Neighbors(ctx context.Context) ([]peerstore.PeerInfo, error)
- func (p *Agent) Self() []multiaddr.Multiaddr
- 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 Context
- type HandleBroadcastInbound
- type HandleUnicastInboundAsync
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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.Network, 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 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.