p2pmocks

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessengerStub

type MessengerStub struct {
	ConnectedFullHistoryPeersOnTopicCalled func(topic string) []core.PeerID
	IDCalled                               func() core.PeerID
	CloseCalled                            func() error
	CreateTopicCalled                      func(name string, createChannelForTopic bool) error
	HasTopicCalled                         func(name string) bool
	HasTopicValidatorCalled                func(name string) bool
	BroadcastOnChannelCalled               func(channel string, topic string, buff []byte)
	BroadcastCalled                        func(topic string, buff []byte)
	RegisterMessageProcessorCalled         func(topic string, identifier string, handler p2p.MessageProcessor) error
	BootstrapCalled                        func() error
	PeerAddressesCalled                    func(pid core.PeerID) []string
	BroadcastOnChannelBlockingCalled       func(channel string, topic string, buff []byte) error
	IsConnectedToTheNetworkCalled          func() bool
	PeersCalled                            func() []core.PeerID
	AddressesCalled                        func() []string
	ConnectToPeerCalled                    func(address string) error
	IsConnectedCalled                      func(peerID core.PeerID) bool
	ConnectedPeersCalled                   func() []core.PeerID
	ConnectedAddressesCalled               func() []string
	ConnectedPeersOnTopicCalled            func(topic string) []core.PeerID
	UnregisterAllMessageProcessorsCalled   func() error
	UnregisterMessageProcessorCalled       func(topic string, identifier string) error
	SendToConnectedPeerCalled              func(topic string, buff []byte, peerID core.PeerID) error
	ThresholdMinConnectedPeersCalled       func() int
	SetThresholdMinConnectedPeersCalled    func(minConnectedPeers int) error
	SetPeerShardResolverCalled             func(peerShardResolver p2p.PeerShardResolver) error
	SetPeerDenialEvaluatorCalled           func(handler p2p.PeerDenialEvaluator) error
	GetConnectedPeersInfoCalled            func() *p2p.ConnectedPeersInfo
	UnjoinAllTopicsCalled                  func() error
	PortCalled                             func() int
	WaitForConnectionsCalled               func(maxWaitingTime time.Duration, minNumOfPeers uint32)
	SignCalled                             func(payload []byte) ([]byte, error)
	VerifyCalled                           func(payload []byte, pid core.PeerID, signature []byte) error
	AddPeerTopicNotifierCalled             func(notifier p2p.PeerTopicNotifier) error
	BroadcastUsingPrivateKeyCalled         func(topic string, buff []byte, pid core.PeerID, skBytes []byte)
	SignUsingPrivateKeyCalled              func(skBytes []byte, payload []byte) ([]byte, error)
}

MessengerStub -

func (*MessengerStub) AddPeerTopicNotifier

func (ms *MessengerStub) AddPeerTopicNotifier(notifier p2p.PeerTopicNotifier) error

AddPeerTopicNotifier -

func (*MessengerStub) Addresses

func (ms *MessengerStub) Addresses() []string

Addresses -

func (*MessengerStub) Bootstrap

func (ms *MessengerStub) Bootstrap() error

Bootstrap -

func (*MessengerStub) Broadcast

func (ms *MessengerStub) Broadcast(topic string, buff []byte)

Broadcast -

func (*MessengerStub) BroadcastOnChannel

func (ms *MessengerStub) BroadcastOnChannel(channel string, topic string, buff []byte)

BroadcastOnChannel -

func (*MessengerStub) BroadcastOnChannelBlocking

func (ms *MessengerStub) BroadcastOnChannelBlocking(channel string, topic string, buff []byte) error

BroadcastOnChannelBlocking -

func (*MessengerStub) BroadcastUsingPrivateKey

func (ms *MessengerStub) BroadcastUsingPrivateKey(topic string, buff []byte, pid core.PeerID, skBytes []byte)

BroadcastUsingPrivateKey -

func (*MessengerStub) Close

func (ms *MessengerStub) Close() error

Close -

func (*MessengerStub) ConnectToPeer

func (ms *MessengerStub) ConnectToPeer(address string) error

ConnectToPeer -

func (*MessengerStub) ConnectedAddresses

func (ms *MessengerStub) ConnectedAddresses() []string

ConnectedAddresses -

func (*MessengerStub) ConnectedFullHistoryPeersOnTopic

func (ms *MessengerStub) ConnectedFullHistoryPeersOnTopic(topic string) []core.PeerID

ConnectedFullHistoryPeersOnTopic -

func (*MessengerStub) ConnectedPeers

func (ms *MessengerStub) ConnectedPeers() []core.PeerID

ConnectedPeers -

func (*MessengerStub) ConnectedPeersOnTopic

func (ms *MessengerStub) ConnectedPeersOnTopic(topic string) []core.PeerID

ConnectedPeersOnTopic -

func (*MessengerStub) CreateTopic

func (ms *MessengerStub) CreateTopic(name string, createChannelForTopic bool) error

CreateTopic -

func (*MessengerStub) GetConnectedPeersInfo

func (ms *MessengerStub) GetConnectedPeersInfo() *p2p.ConnectedPeersInfo

GetConnectedPeersInfo -

func (*MessengerStub) HasTopic

func (ms *MessengerStub) HasTopic(name string) bool

HasTopic -

func (*MessengerStub) HasTopicValidator

func (ms *MessengerStub) HasTopicValidator(name string) bool

HasTopicValidator -

func (*MessengerStub) ID

func (ms *MessengerStub) ID() core.PeerID

ID -

func (*MessengerStub) IsConnected

func (ms *MessengerStub) IsConnected(peerID core.PeerID) bool

IsConnected -

func (*MessengerStub) IsConnectedToTheNetwork

func (ms *MessengerStub) IsConnectedToTheNetwork() bool

IsConnectedToTheNetwork -

func (*MessengerStub) IsInterfaceNil

func (ms *MessengerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MessengerStub) PeerAddresses

func (ms *MessengerStub) PeerAddresses(pid core.PeerID) []string

PeerAddresses -

func (*MessengerStub) Peers

func (ms *MessengerStub) Peers() []core.PeerID

Peers -

func (*MessengerStub) Port

func (ms *MessengerStub) Port() int

Port -

func (*MessengerStub) RegisterMessageProcessor

func (ms *MessengerStub) RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error

RegisterMessageProcessor -

func (*MessengerStub) SendToConnectedPeer

func (ms *MessengerStub) SendToConnectedPeer(topic string, buff []byte, peerID core.PeerID) error

SendToConnectedPeer -

func (*MessengerStub) SetPeerDenialEvaluator

func (ms *MessengerStub) SetPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) error

SetPeerDenialEvaluator -

func (*MessengerStub) SetPeerShardResolver

func (ms *MessengerStub) SetPeerShardResolver(peerShardResolver p2p.PeerShardResolver) error

SetPeerShardResolver -

func (*MessengerStub) SetThresholdMinConnectedPeers

func (ms *MessengerStub) SetThresholdMinConnectedPeers(minConnectedPeers int) error

SetThresholdMinConnectedPeers -

func (*MessengerStub) Sign

func (ms *MessengerStub) Sign(payload []byte) ([]byte, error)

Sign -

func (*MessengerStub) SignUsingPrivateKey

func (ms *MessengerStub) SignUsingPrivateKey(skBytes []byte, payload []byte) ([]byte, error)

SignUsingPrivateKey -

func (*MessengerStub) ThresholdMinConnectedPeers

func (ms *MessengerStub) ThresholdMinConnectedPeers() int

ThresholdMinConnectedPeers -

func (*MessengerStub) UnjoinAllTopics

func (ms *MessengerStub) UnjoinAllTopics() error

UnjoinAllTopics -

func (*MessengerStub) UnregisterAllMessageProcessors

func (ms *MessengerStub) UnregisterAllMessageProcessors() error

UnregisterAllMessageProcessors -

func (*MessengerStub) UnregisterMessageProcessor

func (ms *MessengerStub) UnregisterMessageProcessor(topic string, identifier string) error

UnregisterMessageProcessor -

func (*MessengerStub) Verify

func (ms *MessengerStub) Verify(payload []byte, pid core.PeerID, signature []byte) error

Verify -

func (*MessengerStub) WaitForConnections

func (ms *MessengerStub) WaitForConnections(maxWaitingTime time.Duration, minNumOfPeers uint32)

WaitForConnections -

type NetworkShardingCollectorStub

type NetworkShardingCollectorStub struct {
	UpdatePeerIDPublicKeyPairCalled func(pid core.PeerID, pk []byte)
	UpdatePeerIDInfoCalled          func(pid core.PeerID, pk []byte, shardID uint32)
	PutPeerIdShardIdCalled          func(pid core.PeerID, shardId uint32)
	PutPeerIdSubTypeCalled          func(pid core.PeerID, peerSubType core.P2PPeerSubType)
	GetLastKnownPeerIDCalled        func(pk []byte) (core.PeerID, bool)
	GetPeerInfoCalled               func(pid core.PeerID) core.P2PPeerInfo
}

NetworkShardingCollectorStub -

func (*NetworkShardingCollectorStub) GetLastKnownPeerID

func (nscs *NetworkShardingCollectorStub) GetLastKnownPeerID(pk []byte) (core.PeerID, bool)

GetLastKnownPeerID -

func (*NetworkShardingCollectorStub) GetPeerInfo

func (nscs *NetworkShardingCollectorStub) GetPeerInfo(pid core.PeerID) core.P2PPeerInfo

GetPeerInfo -

func (*NetworkShardingCollectorStub) IsInterfaceNil

func (nscs *NetworkShardingCollectorStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*NetworkShardingCollectorStub) PutPeerIdShardId

func (nscs *NetworkShardingCollectorStub) PutPeerIdShardId(pid core.PeerID, shardID uint32)

PutPeerIdShardId -

func (*NetworkShardingCollectorStub) PutPeerIdSubType

func (nscs *NetworkShardingCollectorStub) PutPeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType)

PutPeerIdSubType -

func (*NetworkShardingCollectorStub) UpdatePeerIDInfo

func (nscs *NetworkShardingCollectorStub) UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32)

UpdatePeerIDInfo -

func (*NetworkShardingCollectorStub) UpdatePeerIDPublicKeyPair

func (nscs *NetworkShardingCollectorStub) UpdatePeerIDPublicKeyPair(pid core.PeerID, pk []byte)

UpdatePeerIDPublicKeyPair -

type PeersHolderStub

type PeersHolderStub struct {
	PutConnectionAddressCalled func(peerID core.PeerID, address string)
	PutShardIDCalled           func(peerID core.PeerID, shardID uint32)
	GetCalled                  func() map[uint32][]core.PeerID
	ContainsCalled             func(peerID core.PeerID) bool
	RemoveCalled               func(peerID core.PeerID)
	ClearCalled                func()
}

PeersHolderStub -

func (*PeersHolderStub) Clear

func (p *PeersHolderStub) Clear()

Clear -

func (*PeersHolderStub) Contains

func (p *PeersHolderStub) Contains(peerID core.PeerID) bool

Contains -

func (*PeersHolderStub) Get

func (p *PeersHolderStub) Get() map[uint32][]core.PeerID

Get -

func (*PeersHolderStub) IsInterfaceNil

func (p *PeersHolderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeersHolderStub) PutConnectionAddress

func (p *PeersHolderStub) PutConnectionAddress(peerID core.PeerID, address string)

PutConnectionAddress -

func (*PeersHolderStub) PutShardID

func (p *PeersHolderStub) PutShardID(peerID core.PeerID, shardID uint32)

PutShardID -

func (*PeersHolderStub) Remove

func (p *PeersHolderStub) Remove(peerID core.PeerID)

Remove -

type PeersRatingHandlerStub

type PeersRatingHandlerStub struct {
	AddPeerCalled                  func(pid core.PeerID)
	IncreaseRatingCalled           func(pid core.PeerID)
	DecreaseRatingCalled           func(pid core.PeerID)
	GetTopRatedPeersFromListCalled func(peers []core.PeerID, numOfPeers int) []core.PeerID
}

PeersRatingHandlerStub -

func (*PeersRatingHandlerStub) AddPeer

func (stub *PeersRatingHandlerStub) AddPeer(pid core.PeerID)

AddPeer -

func (*PeersRatingHandlerStub) DecreaseRating

func (stub *PeersRatingHandlerStub) DecreaseRating(pid core.PeerID)

DecreaseRating -

func (*PeersRatingHandlerStub) GetTopRatedPeersFromList

func (stub *PeersRatingHandlerStub) GetTopRatedPeersFromList(peers []core.PeerID, numOfPeers int) []core.PeerID

GetTopRatedPeersFromList -

func (*PeersRatingHandlerStub) IncreaseRating

func (stub *PeersRatingHandlerStub) IncreaseRating(pid core.PeerID)

IncreaseRating -

func (*PeersRatingHandlerStub) IsInterfaceNil

func (stub *PeersRatingHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

Jump to

Keyboard shortcuts

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