Documentation
¶
Index ¶
- func NewClient(t *testing.T, ctx context.Context, clientNodeID ids.NodeID, ...) *p2p.Client
- func NewClientWithPeers(t *testing.T, ctx context.Context, clientNodeID ids.NodeID, ...) *p2p.Client
- func NewSelfClient(t *testing.T, ctx context.Context, nodeID ids.NodeID, handler p2p.Handler) *p2p.Client
- type AppSender
- func (s *AppSender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, ...) error
- func (s *AppSender) SendGossip(ctx context.Context, config p2p.SendConfig, msg []byte) error
- func (s *AppSender) SendRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, msg []byte) error
- func (s *AppSender) SendResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error
- type WarpSender
- func (s *WarpSender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, ...) error
- func (s *WarpSender) SendGossip(ctx context.Context, nodeIDs set.Set[ids.NodeID], msg []byte) error
- func (s *WarpSender) SendGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], msg []byte) error
- func (s *WarpSender) SendRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, msg []byte) error
- func (s *WarpSender) SendResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient( t *testing.T, ctx context.Context, clientNodeID ids.NodeID, clientHandler p2p.Handler, serverNodeID ids.NodeID, serverHandler p2p.Handler, ) *p2p.Client
NewClient generates a client-server pair and returns the client used to communicate with a server with the specified handler
Types ¶
type AppSender ¶ added in v1.16.56
type AppSender struct {
T *testing.T
// Function hooks - set these to customize behavior
SendRequestF func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
SendResponseF func(context.Context, ids.NodeID, uint32, []byte) error
SendGossipF func(context.Context, p2p.SendConfig, []byte) error
SendErrorF func(context.Context, ids.NodeID, uint32, int32, string) error
// Fail flags - set to true to fail on unexpected calls
CantSendRequest bool
CantSendResponse bool
CantSendGossip bool
CantSendError bool
}
AppSender is a test implementation of p2p.Sender. Set function fields to customize behavior, or leave nil for default no-op. Set Cant* fields to true to fail on unexpected calls.
func (*AppSender) SendGossip ¶ added in v1.16.56
func (*AppSender) SendRequest ¶ added in v1.16.56
type WarpSender ¶ added in v1.16.56
type WarpSender struct {
T *testing.T
// Function hooks - set these to customize behavior
SendRequestF func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
SendResponseF func(context.Context, ids.NodeID, uint32, []byte) error
SendErrorF func(context.Context, ids.NodeID, uint32, int32, string) error
SendGossipF func(context.Context, set.Set[ids.NodeID], []byte) error
SendGossipSpecificF func(context.Context, set.Set[ids.NodeID], []byte) error
// Fail flags - set to true to fail on unexpected calls
CantSendRequest bool
CantSendResponse bool
CantSendError bool
CantSendGossip bool
CantSendGossipSpecific bool
}
WarpSender is a test implementation of p2p.Sender. Set function fields to customize behavior, or leave nil for default no-op. Set Cant* fields to true to fail on unexpected calls.
func (*WarpSender) SendGossip ¶ added in v1.16.56
func (*WarpSender) SendGossipSpecific ¶ added in v1.16.56
func (*WarpSender) SendRequest ¶ added in v1.16.56
func (*WarpSender) SendResponse ¶ added in v1.16.56
Click to show internal directories.
Click to hide internal directories.