Documentation ¶
Index ¶
- type MessageProcessorStub
- type MessengerStub
- func (ms *MessengerStub) Addresses() []string
- func (ms *MessengerStub) Bootstrap() error
- func (ms *MessengerStub) Broadcast(topic string, buff []byte)
- func (ms *MessengerStub) BroadcastOnChannel(channel string, topic string, buff []byte)
- func (ms *MessengerStub) BroadcastOnChannelUsingPrivateKey(channel string, topic string, buff []byte, pid core.PeerID, skBytes []byte)
- func (ms *MessengerStub) BroadcastUsingPrivateKey(topic string, buff []byte, pid core.PeerID, skBytes []byte)
- func (ms *MessengerStub) Close() error
- func (ms *MessengerStub) ConnectToPeer(address string) error
- func (ms *MessengerStub) ConnectedAddresses() []string
- func (ms *MessengerStub) ConnectedPeers() []core.PeerID
- func (ms *MessengerStub) ConnectedPeersOnTopic(topic string) []core.PeerID
- func (ms *MessengerStub) CreateTopic(name string, createChannelForTopic bool) error
- func (ms *MessengerStub) GetConnectedPeersInfo() *p2p.ConnectedPeersInfo
- func (ms *MessengerStub) HasCompatibleProtocolID(address string) bool
- func (ms *MessengerStub) HasTopic(name string) bool
- func (ms *MessengerStub) HasTopicValidator(name string) bool
- func (ms *MessengerStub) ID() core.PeerID
- func (ms *MessengerStub) IsConnected(peerID core.PeerID) bool
- func (ms *MessengerStub) IsConnectedToTheNetwork() bool
- func (ms *MessengerStub) IsInterfaceNil() bool
- func (ms *MessengerStub) PeerAddresses(pid core.PeerID) []string
- func (ms *MessengerStub) Peers() []core.PeerID
- func (ms *MessengerStub) Port() int
- func (ms *MessengerStub) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID, ...) error
- func (ms *MessengerStub) RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error
- func (ms *MessengerStub) SendToConnectedPeer(topic string, buff []byte, peerID core.PeerID) error
- func (ms *MessengerStub) SetDebugger(debugger p2p.Debugger) error
- func (ms *MessengerStub) SetPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) error
- func (ms *MessengerStub) SetPeerShardResolver(peerShardResolver p2p.PeerShardResolver) error
- func (ms *MessengerStub) SetThresholdMinConnectedPeers(minConnectedPeers int) error
- func (ms *MessengerStub) Sign(payload []byte) ([]byte, error)
- func (ms *MessengerStub) SignUsingPrivateKey(skBytes []byte, payload []byte) ([]byte, error)
- func (ms *MessengerStub) ThresholdMinConnectedPeers() int
- func (ms *MessengerStub) UnJoinAllTopics() error
- func (ms *MessengerStub) UnregisterAllMessageProcessors() error
- func (ms *MessengerStub) UnregisterMessageProcessor(topic string, identifier string) error
- func (ms *MessengerStub) Verify(payload []byte, pid core.PeerID, signature []byte) error
- func (ms *MessengerStub) WaitForConnections(maxWaitingTime time.Duration, minNumOfPeers uint32)
- type NetworkShardingCollectorStub
- func (nscs *NetworkShardingCollectorStub) GetLastKnownPeerID(pk []byte) (core.PeerID, bool)
- func (nscs *NetworkShardingCollectorStub) GetPeerInfo(pid core.PeerID) core.P2PPeerInfo
- func (nscs *NetworkShardingCollectorStub) IsInterfaceNil() bool
- func (nscs *NetworkShardingCollectorStub) PutPeerIdShardId(pid core.PeerID, shardID uint32)
- func (nscs *NetworkShardingCollectorStub) PutPeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType)
- func (nscs *NetworkShardingCollectorStub) UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32)
- func (nscs *NetworkShardingCollectorStub) UpdatePeerIDPublicKeyPair(pid core.PeerID, pk []byte)
- type P2PKeyConverterStub
- type P2PMessageMock
- func (msg *P2PMessageMock) BroadcastMethod() p2p.BroadcastMethod
- func (msg *P2PMessageMock) Data() []byte
- func (msg *P2PMessageMock) From() []byte
- func (msg *P2PMessageMock) IsInterfaceNil() bool
- func (msg *P2PMessageMock) Key() []byte
- func (msg *P2PMessageMock) Payload() []byte
- func (msg *P2PMessageMock) Peer() core.PeerID
- func (msg *P2PMessageMock) SeqNo() []byte
- func (msg *P2PMessageMock) Signature() []byte
- func (msg *P2PMessageMock) Timestamp() int64
- func (msg *P2PMessageMock) Topic() string
- type PeersHolderStub
- func (p *PeersHolderStub) Clear()
- func (p *PeersHolderStub) Contains(peerID core.PeerID) bool
- func (p *PeersHolderStub) Get() map[uint32][]core.PeerID
- func (p *PeersHolderStub) IsInterfaceNil() bool
- func (p *PeersHolderStub) PutConnectionAddress(peerID core.PeerID, address string)
- func (p *PeersHolderStub) PutShardID(peerID core.PeerID, shardID uint32)
- func (p *PeersHolderStub) Remove(peerID core.PeerID)
- type PeersRatingHandlerStub
- func (stub *PeersRatingHandlerStub) DecreaseRating(pid core.PeerID)
- func (stub *PeersRatingHandlerStub) GetTopRatedPeersFromList(peers []core.PeerID, numOfPeers int) []core.PeerID
- func (stub *PeersRatingHandlerStub) IncreaseRating(pid core.PeerID)
- func (stub *PeersRatingHandlerStub) IsInterfaceNil() bool
- type PeersRatingMonitorStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageProcessorStub ¶ added in v1.7.1
type MessageProcessorStub struct {
ProcessReceivedMessageCalled func(message p2p.MessageP2P, fromConnectedPeer core.PeerID, source p2p.MessageHandler) error
}
MessageProcessorStub -
func (*MessageProcessorStub) IsInterfaceNil ¶ added in v1.7.1
func (stub *MessageProcessorStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*MessageProcessorStub) ProcessReceivedMessage ¶ added in v1.7.1
func (stub *MessageProcessorStub) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID, source p2p.MessageHandler) error
ProcessReceivedMessage -
type MessengerStub ¶
type MessengerStub struct { 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 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 BroadcastUsingPrivateKeyCalled func(topic string, buff []byte, pid core.PeerID, skBytes []byte) BroadcastOnChannelUsingPrivateKeyCalled func(channel string, topic string, buff []byte, pid core.PeerID, skBytes []byte) SignUsingPrivateKeyCalled func(skBytes []byte, payload []byte) ([]byte, error) ProcessReceivedMessageCalled func(message p2p.MessageP2P, fromConnectedPeer core.PeerID, source p2p.MessageHandler) error SetDebuggerCalled func(debugger p2p.Debugger) error HasCompatibleProtocolIDCalled func(address string) bool }
MessengerStub -
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) BroadcastOnChannelUsingPrivateKey ¶ added in v1.6.0
func (ms *MessengerStub) BroadcastOnChannelUsingPrivateKey(channel string, topic string, buff []byte, pid core.PeerID, skBytes []byte)
BroadcastOnChannelUsingPrivateKey -
func (*MessengerStub) BroadcastUsingPrivateKey ¶
func (ms *MessengerStub) BroadcastUsingPrivateKey(topic string, buff []byte, pid core.PeerID, skBytes []byte)
BroadcastUsingPrivateKey -
func (*MessengerStub) ConnectToPeer ¶
func (ms *MessengerStub) ConnectToPeer(address string) error
ConnectToPeer -
func (*MessengerStub) ConnectedAddresses ¶
func (ms *MessengerStub) ConnectedAddresses() []string
ConnectedAddresses -
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) HasCompatibleProtocolID ¶ added in v1.7.0
func (ms *MessengerStub) HasCompatibleProtocolID(address string) bool
HasCompatibleProtocolID -
func (*MessengerStub) HasTopicValidator ¶
func (ms *MessengerStub) HasTopicValidator(name string) bool
HasTopicValidator -
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) ProcessReceivedMessage ¶ added in v1.6.0
func (ms *MessengerStub) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID, source p2p.MessageHandler) error
ProcessReceivedMessage -
func (*MessengerStub) RegisterMessageProcessor ¶
func (ms *MessengerStub) RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error
RegisterMessageProcessor -
func (*MessengerStub) SendToConnectedPeer ¶
SendToConnectedPeer -
func (*MessengerStub) SetDebugger ¶ added in v1.6.2
func (ms *MessengerStub) SetDebugger(debugger p2p.Debugger) error
SetDebugger -
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) SignUsingPrivateKey ¶
func (ms *MessengerStub) SignUsingPrivateKey(skBytes []byte, payload []byte) ([]byte, error)
SignUsingPrivateKey -
func (*MessengerStub) ThresholdMinConnectedPeers ¶
func (ms *MessengerStub) ThresholdMinConnectedPeers() int
ThresholdMinConnectedPeers -
func (*MessengerStub) UnJoinAllTopics ¶ added in v1.6.0
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) 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 P2PKeyConverterStub ¶ added in v1.6.0
type P2PKeyConverterStub struct { ConvertPeerIDToPublicKeyCalled func(keyGen crypto.KeyGenerator, pid core.PeerID) (crypto.PublicKey, error) ConvertPublicKeyToPeerIDCalled func(pk crypto.PublicKey) (core.PeerID, error) }
P2PKeyConverterStub -
func (*P2PKeyConverterStub) ConvertPeerIDToPublicKey ¶ added in v1.6.0
func (stub *P2PKeyConverterStub) ConvertPeerIDToPublicKey(keyGen crypto.KeyGenerator, pid core.PeerID) (crypto.PublicKey, error)
ConvertPeerIDToPublicKey -
func (*P2PKeyConverterStub) ConvertPublicKeyToPeerID ¶ added in v1.6.0
ConvertPublicKeyToPeerID -
func (*P2PKeyConverterStub) IsInterfaceNil ¶ added in v1.6.0
func (stub *P2PKeyConverterStub) IsInterfaceNil() bool
IsInterfaceNil -
type P2PMessageMock ¶ added in v1.6.0
type P2PMessageMock struct { FromField []byte DataField []byte SeqNoField []byte TopicField string SignatureField []byte KeyField []byte PeerField core.PeerID PayloadField []byte TimestampField int64 BroadcastMethodField p2p.BroadcastMethod }
P2PMessageMock -
func (*P2PMessageMock) BroadcastMethod ¶ added in v1.6.0
func (msg *P2PMessageMock) BroadcastMethod() p2p.BroadcastMethod
BroadcastMethod -
func (*P2PMessageMock) IsInterfaceNil ¶ added in v1.6.0
func (msg *P2PMessageMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*P2PMessageMock) Payload ¶ added in v1.6.0
func (msg *P2PMessageMock) Payload() []byte
Payload -
func (*P2PMessageMock) Signature ¶ added in v1.6.0
func (msg *P2PMessageMock) Signature() []byte
Signature -
func (*P2PMessageMock) Timestamp ¶ added in v1.6.0
func (msg *P2PMessageMock) Timestamp() int64
Timestamp -
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) Contains ¶
func (p *PeersHolderStub) Contains(peerID core.PeerID) bool
Contains -
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 -
type PeersRatingHandlerStub ¶
type PeersRatingHandlerStub struct { IncreaseRatingCalled func(pid core.PeerID) DecreaseRatingCalled func(pid core.PeerID) GetTopRatedPeersFromListCalled func(peers []core.PeerID, numOfPeers int) []core.PeerID CloseCalled func() error }
PeersRatingHandlerStub -
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
type PeersRatingMonitorStub ¶ added in v1.6.0
type PeersRatingMonitorStub struct {
GetConnectedPeersRatingsCalled func(connectionsHandler p2p.ConnectionsHandler) (string, error)
}
PeersRatingMonitorStub -
func (*PeersRatingMonitorStub) GetConnectedPeersRatings ¶ added in v1.6.0
func (stub *PeersRatingMonitorStub) GetConnectedPeersRatings(connectionsHandler p2p.ConnectionsHandler) (string, error)
GetConnectedPeersRatings -
func (*PeersRatingMonitorStub) IsInterfaceNil ¶ added in v1.6.0
func (stub *PeersRatingMonitorStub) IsInterfaceNil() bool
IsInterfaceNil -