Help us shape the future of Go! Take the 2026 Go Developer Survey

p2ptest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

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

func NewClientWithPeers

func NewClientWithPeers(
	t *testing.T,
	ctx context.Context,
	clientNodeID ids.NodeID,
	clientHandler p2p.Handler,
	peers map[ids.NodeID]p2p.Handler,
) *p2p.Client

NewClientWithPeers generates a client to communicate to a set of peers

func NewSelfClient

func NewSelfClient(t *testing.T, ctx context.Context, nodeID ids.NodeID, handler p2p.Handler) *p2p.Client

Types

type Sender

type Sender struct {
	SendAppGossipF             func(ctx context.Context, sendConfig appsender.SendConfig, gossipBytes []byte) error
	SendAppGossipSpecificF     func(ctx context.Context, nodeIDs set.Set[ids.NodeID], gossipBytes []byte) error
	SendAppRequestF            func(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, requestBytes []byte) error
	SendAppResponseF           func(ctx context.Context, nodeID ids.NodeID, requestID uint32, responseBytes []byte) error
	SendAppErrorF              func(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
	SendCrossChainAppRequestF  func(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
	SendCrossChainAppResponseF func(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
	SendCrossChainAppErrorF    func(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
}

Sender is a test implementation of appsender.AppSender

func (*Sender) SendAppError

func (s *Sender) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error

SendAppError implements core.AppSender

func (*Sender) SendAppGossip

func (s *Sender) SendAppGossip(ctx context.Context, sendConfig appsender.SendConfig, appGossipBytes []byte) error

SendAppGossip implements appsender.AppSender

func (*Sender) SendAppGossipSpecific

func (s *Sender) SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error

SendAppGossipSpecific implements core.AppSender

func (*Sender) SendAppRequest

func (s *Sender) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error

SendAppRequest implements core.AppSender

func (*Sender) SendAppResponse

func (s *Sender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error

SendAppResponse implements core.AppSender

func (*Sender) SendCrossChainAppError

func (s *Sender) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error

SendCrossChainAppError implements core.AppSender

func (*Sender) SendCrossChainAppRequest

func (s *Sender) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error

SendCrossChainAppRequest implements core.AppSender

func (*Sender) SendCrossChainAppResponse

func (s *Sender) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error

SendCrossChainAppResponse implements core.AppSender

Jump to

Keyboard shortcuts

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