mockp2p

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionGater

type ConnectionGater struct {
	mock.Mock
}

ConnectionGater is an autogenerated mock type for the ConnectionGater type

func NewConnectionGater

func NewConnectionGater(t mockConstructorTestingTNewConnectionGater) *ConnectionGater

NewConnectionGater creates a new instance of ConnectionGater. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*ConnectionGater) InterceptAccept

func (_m *ConnectionGater) InterceptAccept(_a0 network.ConnMultiaddrs) bool

InterceptAccept provides a mock function with given fields: _a0

func (*ConnectionGater) InterceptAddrDial

func (_m *ConnectionGater) InterceptAddrDial(_a0 peer.ID, _a1 multiaddr.Multiaddr) bool

InterceptAddrDial provides a mock function with given fields: _a0, _a1

func (*ConnectionGater) InterceptPeerDial

func (_m *ConnectionGater) InterceptPeerDial(p peer.ID) bool

InterceptPeerDial provides a mock function with given fields: p

func (*ConnectionGater) InterceptSecured

func (_m *ConnectionGater) InterceptSecured(_a0 network.Direction, _a1 peer.ID, _a2 network.ConnMultiaddrs) bool

InterceptSecured provides a mock function with given fields: _a0, _a1, _a2

func (*ConnectionGater) InterceptUpgraded

func (_m *ConnectionGater) InterceptUpgraded(_a0 network.Conn) (bool, control.DisconnectReason)

InterceptUpgraded provides a mock function with given fields: _a0

type Connector

type Connector struct {
	mock.Mock
}

Connector is an autogenerated mock type for the Connector type

func NewConnector

func NewConnector(t mockConstructorTestingTNewConnector) *Connector

NewConnector creates a new instance of Connector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Connector) UpdatePeers

func (_m *Connector) UpdatePeers(ctx context.Context, peerIDs peer.IDSlice)

UpdatePeers provides a mock function with given fields: ctx, peerIDs

type GetTimeNow

type GetTimeNow struct {
	mock.Mock
}

GetTimeNow is an autogenerated mock type for the GetTimeNow type

func NewGetTimeNow

func NewGetTimeNow(t mockConstructorTestingTNewGetTimeNow) *GetTimeNow

NewGetTimeNow creates a new instance of GetTimeNow. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*GetTimeNow) Execute

func (_m *GetTimeNow) Execute() time.Time

Execute provides a mock function with given fields:

type IDTranslator

type IDTranslator struct {
	mock.Mock
}

IDTranslator is an autogenerated mock type for the IDTranslator type

func NewIDTranslator

func NewIDTranslator(t mockConstructorTestingTNewIDTranslator) *IDTranslator

NewIDTranslator creates a new instance of IDTranslator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*IDTranslator) GetFlowID

func (_m *IDTranslator) GetFlowID(_a0 peer.ID) (flow.Identifier, error)

GetFlowID provides a mock function with given fields: _a0

func (*IDTranslator) GetPeerID

func (_m *IDTranslator) GetPeerID(_a0 flow.Identifier) (peer.ID, error)

GetPeerID provides a mock function with given fields: _a0

type LibP2PNode

type LibP2PNode struct {
	mock.Mock
}

LibP2PNode is an autogenerated mock type for the LibP2PNode type

func NewLibP2PNode

func NewLibP2PNode(t mockConstructorTestingTNewLibP2PNode) *LibP2PNode

NewLibP2PNode creates a new instance of LibP2PNode. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*LibP2PNode) AddPeer

func (_m *LibP2PNode) AddPeer(ctx context.Context, peerInfo peer.AddrInfo) error

AddPeer provides a mock function with given fields: ctx, peerInfo

func (*LibP2PNode) CreateStream

func (_m *LibP2PNode) CreateStream(ctx context.Context, peerID peer.ID) (network.Stream, error)

CreateStream provides a mock function with given fields: ctx, peerID

func (*LibP2PNode) Done

func (_m *LibP2PNode) Done() <-chan struct{}

Done provides a mock function with given fields:

func (*LibP2PNode) GetIPPort

func (_m *LibP2PNode) GetIPPort() (string, string, error)

GetIPPort provides a mock function with given fields:

func (*LibP2PNode) GetPeersForProtocol

func (_m *LibP2PNode) GetPeersForProtocol(pid protocol.ID) peer.IDSlice

GetPeersForProtocol provides a mock function with given fields: pid

func (*LibP2PNode) HasSubscription

func (_m *LibP2PNode) HasSubscription(topic channels.Topic) bool

HasSubscription provides a mock function with given fields: topic

func (*LibP2PNode) Host

func (_m *LibP2PNode) Host() host.Host

Host provides a mock function with given fields:

func (*LibP2PNode) IsConnected

func (_m *LibP2PNode) IsConnected(peerID peer.ID) (bool, error)

IsConnected provides a mock function with given fields: peerID

func (*LibP2PNode) ListPeers

func (_m *LibP2PNode) ListPeers(topic string) []peer.ID

ListPeers provides a mock function with given fields: topic

func (*LibP2PNode) PeerManagerComponent

func (_m *LibP2PNode) PeerManagerComponent() component.Component

PeerManagerComponent provides a mock function with given fields:

func (*LibP2PNode) Publish

func (_m *LibP2PNode) Publish(ctx context.Context, topic channels.Topic, data []byte) error

Publish provides a mock function with given fields: ctx, topic, data

func (*LibP2PNode) Ready

func (_m *LibP2PNode) Ready() <-chan struct{}

Ready provides a mock function with given fields:

func (*LibP2PNode) RemovePeer

func (_m *LibP2PNode) RemovePeer(peerID peer.ID) error

RemovePeer provides a mock function with given fields: peerID

func (*LibP2PNode) RequestPeerUpdate

func (_m *LibP2PNode) RequestPeerUpdate()

RequestPeerUpdate provides a mock function with given fields:

func (*LibP2PNode) Routing

func (_m *LibP2PNode) Routing() routing.Routing

Routing provides a mock function with given fields:

func (*LibP2PNode) RoutingTable

func (_m *LibP2PNode) RoutingTable() *kbucket.RoutingTable

RoutingTable provides a mock function with given fields:

func (*LibP2PNode) SetComponentManager

func (_m *LibP2PNode) SetComponentManager(cm *component.ComponentManager)

SetComponentManager provides a mock function with given fields: cm

func (*LibP2PNode) SetPubSub

func (_m *LibP2PNode) SetPubSub(ps p2p.PubSubAdapter)

SetPubSub provides a mock function with given fields: ps

func (*LibP2PNode) SetRouting

func (_m *LibP2PNode) SetRouting(r routing.Routing)

SetRouting provides a mock function with given fields: r

func (*LibP2PNode) Start

func (_m *LibP2PNode) Start(ctx irrecoverable.SignalerContext)

Start provides a mock function with given fields: ctx

func (*LibP2PNode) Stop

func (_m *LibP2PNode) Stop() error

Stop provides a mock function with given fields:

func (*LibP2PNode) Subscribe

func (_m *LibP2PNode) Subscribe(topic channels.Topic, topicValidator p2p.TopicValidatorFunc) (p2p.Subscription, error)

Subscribe provides a mock function with given fields: topic, topicValidator

func (*LibP2PNode) UnSubscribe

func (_m *LibP2PNode) UnSubscribe(topic channels.Topic) error

UnSubscribe provides a mock function with given fields: topic

func (*LibP2PNode) WithDefaultUnicastProtocol

func (_m *LibP2PNode) WithDefaultUnicastProtocol(defaultHandler network.StreamHandler, preferred []unicast.ProtocolName) error

WithDefaultUnicastProtocol provides a mock function with given fields: defaultHandler, preferred

func (*LibP2PNode) WithPeersProvider

func (_m *LibP2PNode) WithPeersProvider(peersProvider p2p.PeersProvider)

WithPeersProvider provides a mock function with given fields: peersProvider

type NetworkOptFunction

type NetworkOptFunction struct {
	mock.Mock
}

NetworkOptFunction is an autogenerated mock type for the NetworkOptFunction type

func NewNetworkOptFunction

func NewNetworkOptFunction(t mockConstructorTestingTNewNetworkOptFunction) *NetworkOptFunction

NewNetworkOptFunction creates a new instance of NetworkOptFunction. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*NetworkOptFunction) Execute

func (_m *NetworkOptFunction) Execute(_a0 *p2p.Network)

Execute provides a mock function with given fields: _a0

type PeerFilter

type PeerFilter struct {
	mock.Mock
}

PeerFilter is an autogenerated mock type for the PeerFilter type

func NewPeerFilter

func NewPeerFilter(t mockConstructorTestingTNewPeerFilter) *PeerFilter

NewPeerFilter creates a new instance of PeerFilter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PeerFilter) Execute

func (_m *PeerFilter) Execute(_a0 peer.ID) error

Execute provides a mock function with given fields: _a0

type PeerManager

type PeerManager struct {
	mock.Mock
}

PeerManager is an autogenerated mock type for the PeerManager type

func NewPeerManager

func NewPeerManager(t mockConstructorTestingTNewPeerManager) *PeerManager

NewPeerManager creates a new instance of PeerManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PeerManager) Done

func (_m *PeerManager) Done() <-chan struct{}

Done provides a mock function with given fields:

func (*PeerManager) ForceUpdatePeers

func (_m *PeerManager) ForceUpdatePeers(_a0 context.Context)

ForceUpdatePeers provides a mock function with given fields: _a0

func (*PeerManager) Ready

func (_m *PeerManager) Ready() <-chan struct{}

Ready provides a mock function with given fields:

func (*PeerManager) RequestPeerUpdate

func (_m *PeerManager) RequestPeerUpdate()

RequestPeerUpdate provides a mock function with given fields:

func (*PeerManager) SetPeersProvider

func (_m *PeerManager) SetPeersProvider(_a0 p2p.PeersProvider)

SetPeersProvider provides a mock function with given fields: _a0

func (*PeerManager) Start

func (_m *PeerManager) Start(_a0 irrecoverable.SignalerContext)

Start provides a mock function with given fields: _a0

type PeerManagerFactoryFunc

type PeerManagerFactoryFunc struct {
	mock.Mock
}

PeerManagerFactoryFunc is an autogenerated mock type for the PeerManagerFactoryFunc type

func NewPeerManagerFactoryFunc

func NewPeerManagerFactoryFunc(t mockConstructorTestingTNewPeerManagerFactoryFunc) *PeerManagerFactoryFunc

NewPeerManagerFactoryFunc creates a new instance of PeerManagerFactoryFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PeerManagerFactoryFunc) Execute

func (_m *PeerManagerFactoryFunc) Execute(_a0 host.Host, peersProvider p2p.PeersProvider, logger zerolog.Logger) (p2p.PeerManager, error)

Execute provides a mock function with given fields: _a0, peersProvider, logger

type PeersProvider

type PeersProvider struct {
	mock.Mock
}

PeersProvider is an autogenerated mock type for the PeersProvider type

func NewPeersProvider

func NewPeersProvider(t mockConstructorTestingTNewPeersProvider) *PeersProvider

NewPeersProvider creates a new instance of PeersProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PeersProvider) Execute

func (_m *PeersProvider) Execute() peer.IDSlice

Execute provides a mock function with given fields:

type PubSubAdapter

type PubSubAdapter struct {
	mock.Mock
}

PubSubAdapter is an autogenerated mock type for the PubSubAdapter type

func NewPubSubAdapter

func NewPubSubAdapter(t mockConstructorTestingTNewPubSubAdapter) *PubSubAdapter

NewPubSubAdapter creates a new instance of PubSubAdapter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PubSubAdapter) GetTopics

func (_m *PubSubAdapter) GetTopics() []string

GetTopics provides a mock function with given fields:

func (*PubSubAdapter) Join

func (_m *PubSubAdapter) Join(topic string) (p2p.Topic, error)

Join provides a mock function with given fields: topic

func (*PubSubAdapter) ListPeers

func (_m *PubSubAdapter) ListPeers(topic string) []peer.ID

ListPeers provides a mock function with given fields: topic

func (*PubSubAdapter) RegisterTopicValidator

func (_m *PubSubAdapter) RegisterTopicValidator(topic string, topicValidator p2p.TopicValidatorFunc) error

RegisterTopicValidator provides a mock function with given fields: topic, topicValidator

func (*PubSubAdapter) UnregisterTopicValidator

func (_m *PubSubAdapter) UnregisterTopicValidator(topic string) error

UnregisterTopicValidator provides a mock function with given fields: topic

type PubSubAdapterConfig

type PubSubAdapterConfig struct {
	mock.Mock
}

PubSubAdapterConfig is an autogenerated mock type for the PubSubAdapterConfig type

func NewPubSubAdapterConfig

func NewPubSubAdapterConfig(t mockConstructorTestingTNewPubSubAdapterConfig) *PubSubAdapterConfig

NewPubSubAdapterConfig creates a new instance of PubSubAdapterConfig. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*PubSubAdapterConfig) WithAppSpecificRpcInspector

func (_m *PubSubAdapterConfig) WithAppSpecificRpcInspector(f func(peer.ID, *pubsub.RPC) error)

WithAppSpecificRpcInspector provides a mock function with given fields: f

func (*PubSubAdapterConfig) WithMessageIdFunction

func (_m *PubSubAdapterConfig) WithMessageIdFunction(f func([]byte) string)

WithMessageIdFunction provides a mock function with given fields: f

func (*PubSubAdapterConfig) WithRoutingDiscovery

func (_m *PubSubAdapterConfig) WithRoutingDiscovery(_a0 routing.ContentRouting)

WithRoutingDiscovery provides a mock function with given fields: _a0

func (*PubSubAdapterConfig) WithScoreOption

func (_m *PubSubAdapterConfig) WithScoreOption(_a0 p2p.ScoreOptionBuilder)

WithScoreOption provides a mock function with given fields: _a0

func (*PubSubAdapterConfig) WithSubscriptionFilter

func (_m *PubSubAdapterConfig) WithSubscriptionFilter(_a0 p2p.SubscriptionFilter)

WithSubscriptionFilter provides a mock function with given fields: _a0

type RateLimiter

type RateLimiter struct {
	mock.Mock
}

RateLimiter is an autogenerated mock type for the RateLimiter type

func NewRateLimiter

func NewRateLimiter(t mockConstructorTestingTNewRateLimiter) *RateLimiter

NewRateLimiter creates a new instance of RateLimiter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*RateLimiter) Allow

func (_m *RateLimiter) Allow(peerID peer.ID, msgSize int) bool

Allow provides a mock function with given fields: peerID, msgSize

func (*RateLimiter) IsRateLimited

func (_m *RateLimiter) IsRateLimited(peerID peer.ID) bool

IsRateLimited provides a mock function with given fields: peerID

func (*RateLimiter) SetTimeNowFunc

func (_m *RateLimiter) SetTimeNowFunc(now p2p.GetTimeNow)

SetTimeNowFunc provides a mock function with given fields: now

func (*RateLimiter) Start

func (_m *RateLimiter) Start()

Start provides a mock function with given fields:

func (*RateLimiter) Stop

func (_m *RateLimiter) Stop()

Stop provides a mock function with given fields:

type RateLimiterOpt

type RateLimiterOpt struct {
	mock.Mock
}

RateLimiterOpt is an autogenerated mock type for the RateLimiterOpt type

func NewRateLimiterOpt

func NewRateLimiterOpt(t mockConstructorTestingTNewRateLimiterOpt) *RateLimiterOpt

NewRateLimiterOpt creates a new instance of RateLimiterOpt. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*RateLimiterOpt) Execute

func (_m *RateLimiterOpt) Execute(limiter p2p.RateLimiter)

Execute provides a mock function with given fields: limiter

type ScoreOption

type ScoreOption struct {
	mock.Mock
}

ScoreOption is an autogenerated mock type for the ScoreOption type

func NewScoreOption

func NewScoreOption(t mockConstructorTestingTNewScoreOption) *ScoreOption

NewScoreOption creates a new instance of ScoreOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*ScoreOption) BuildFlowPubSubScoreOption

func (_m *ScoreOption) BuildFlowPubSubScoreOption() pubsub.Option

BuildFlowPubSubScoreOption provides a mock function with given fields:

type ScoreOptionBuilder

type ScoreOptionBuilder struct {
	mock.Mock
}

ScoreOptionBuilder is an autogenerated mock type for the ScoreOptionBuilder type

func NewScoreOptionBuilder

func NewScoreOptionBuilder(t mockConstructorTestingTNewScoreOptionBuilder) *ScoreOptionBuilder

NewScoreOptionBuilder creates a new instance of ScoreOptionBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*ScoreOptionBuilder) BuildFlowPubSubScoreOption

func (_m *ScoreOptionBuilder) BuildFlowPubSubScoreOption() pubsub.Option

BuildFlowPubSubScoreOption provides a mock function with given fields:

type Subscription

type Subscription struct {
	mock.Mock
}

Subscription is an autogenerated mock type for the Subscription type

func NewSubscription

func NewSubscription(t mockConstructorTestingTNewSubscription) *Subscription

NewSubscription creates a new instance of Subscription. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Subscription) Cancel

func (_m *Subscription) Cancel()

Cancel provides a mock function with given fields:

func (*Subscription) Next

func (_m *Subscription) Next(_a0 context.Context) (*pubsub.Message, error)

Next provides a mock function with given fields: _a0

func (*Subscription) Topic

func (_m *Subscription) Topic() string

Topic provides a mock function with given fields:

type SubscriptionFilter

type SubscriptionFilter struct {
	mock.Mock
}

SubscriptionFilter is an autogenerated mock type for the SubscriptionFilter type

func NewSubscriptionFilter

func NewSubscriptionFilter(t mockConstructorTestingTNewSubscriptionFilter) *SubscriptionFilter

NewSubscriptionFilter creates a new instance of SubscriptionFilter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*SubscriptionFilter) CanSubscribe

func (_m *SubscriptionFilter) CanSubscribe(_a0 string) bool

CanSubscribe provides a mock function with given fields: _a0

func (*SubscriptionFilter) FilterIncomingSubscriptions

func (_m *SubscriptionFilter) FilterIncomingSubscriptions(_a0 peer.ID, _a1 []*pubsub_pb.RPC_SubOpts) ([]*pubsub_pb.RPC_SubOpts, error)

FilterIncomingSubscriptions provides a mock function with given fields: _a0, _a1

type SubscriptionProvider

type SubscriptionProvider struct {
	mock.Mock
}

SubscriptionProvider is an autogenerated mock type for the SubscriptionProvider type

func NewSubscriptionProvider

func NewSubscriptionProvider(t mockConstructorTestingTNewSubscriptionProvider) *SubscriptionProvider

NewSubscriptionProvider creates a new instance of SubscriptionProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*SubscriptionProvider) GetSubscribedTopics

func (_m *SubscriptionProvider) GetSubscribedTopics(pid peer.ID) []string

GetSubscribedTopics provides a mock function with given fields: pid

type Topic

type Topic struct {
	mock.Mock
}

Topic is an autogenerated mock type for the Topic type

func NewTopic

func NewTopic(t mockConstructorTestingTNewTopic) *Topic

NewTopic creates a new instance of Topic. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Topic) Close

func (_m *Topic) Close() error

Close provides a mock function with given fields:

func (*Topic) Publish

func (_m *Topic) Publish(_a0 context.Context, _a1 []byte) error

Publish provides a mock function with given fields: _a0, _a1

func (*Topic) String

func (_m *Topic) String() string

String provides a mock function with given fields:

func (*Topic) Subscribe

func (_m *Topic) Subscribe() (p2p.Subscription, error)

Subscribe provides a mock function with given fields:

type TopicProvider

type TopicProvider struct {
	mock.Mock
}

TopicProvider is an autogenerated mock type for the TopicProvider type

func NewTopicProvider

func NewTopicProvider(t mockConstructorTestingTNewTopicProvider) *TopicProvider

NewTopicProvider creates a new instance of TopicProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*TopicProvider) GetTopics

func (_m *TopicProvider) GetTopics() []string

GetTopics provides a mock function with given fields:

func (*TopicProvider) ListPeers

func (_m *TopicProvider) ListPeers(topic string) []peer.ID

ListPeers provides a mock function with given fields: topic

type TopicValidatorFunc

type TopicValidatorFunc struct {
	mock.Mock
}

TopicValidatorFunc is an autogenerated mock type for the TopicValidatorFunc type

func NewTopicValidatorFunc

func NewTopicValidatorFunc(t mockConstructorTestingTNewTopicValidatorFunc) *TopicValidatorFunc

NewTopicValidatorFunc creates a new instance of TopicValidatorFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*TopicValidatorFunc) Execute

Execute provides a mock function with given fields: _a0, _a1, _a2

Jump to

Keyboard shortcuts

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