Documentation ¶
Index ¶
- type MockDiscoveryClient
- type MockIdentityClient
- type MockNetworkingServer
- func (m *MockNetworkingServer) AddPeer(id peer.ID, direction network.Direction)
- func (m *MockNetworkingServer) AddToPeerStore(peerInfo *peer.AddrInfo)
- func (m *MockNetworkingServer) CloseProtocolStream(protocol string, peerID peer.ID) error
- func (m *MockNetworkingServer) DisconnectFromPeer(peerID peer.ID, reason string)
- func (m *MockNetworkingServer) EmitEvent(event *event.PeerEvent)
- func (m *MockNetworkingServer) FetchOrSetTemporaryDial(peerID peer.ID, newValue bool) bool
- func (m *MockNetworkingServer) GetBootnodeConnCount() int64
- func (m *MockNetworkingServer) GetMockDiscoveryClient() *MockDiscoveryClient
- func (m *MockNetworkingServer) GetMockIdentityClient() *MockIdentityClient
- func (m *MockNetworkingServer) GetMockPeerMetrics() *MockPeerMetrics
- func (m *MockNetworkingServer) GetPeerInfo(peerID peer.ID) *peer.AddrInfo
- func (m *MockNetworkingServer) GetRandomBootnode() *peer.AddrInfo
- func (m *MockNetworkingServer) GetRandomPeer() *peer.ID
- func (m *MockNetworkingServer) HasFreeConnectionSlot(direction network.Direction) bool
- func (m *MockNetworkingServer) HookAddPeer(fn addPeerDelegate)
- func (m *MockNetworkingServer) HookAddToPeerStore(fn addToPeerStoreDelegate)
- func (m *MockNetworkingServer) HookCloseProtocolStream(fn closeProtocolStreamDelegate)
- func (m *MockNetworkingServer) HookDisconnectFromPeer(fn disconnectFromPeerDelegate)
- func (m *MockNetworkingServer) HookEmitEvent(fn emitEventDelegate)
- func (m *MockNetworkingServer) HookFetchAndSetTemporaryDial(fn fetchAndSetTemporaryDialDelegate)
- func (m *MockNetworkingServer) HookGetBootnodeConnCount(fn getBootnodeConnCountDelegate)
- func (m *MockNetworkingServer) HookGetPeerInfo(fn getPeerInfoDelegate)
- func (m *MockNetworkingServer) HookGetRandomBootnode(fn getRandomBootnodeDelegate)
- func (m *MockNetworkingServer) HookGetRandomPeer(fn getRandomPeerDelegate)
- func (m *MockNetworkingServer) HookHasFreeConnectionSlot(fn hasFreeConnectionSlotDelegate)
- func (m *MockNetworkingServer) HookIsTemporaryDial(fn isTemporaryDialDelegate)
- func (m *MockNetworkingServer) HookNewDiscoveryClient(fn newDiscoveryClientDelegate)
- func (m *MockNetworkingServer) HookNewIdentityClient(fn newIdentityClientDelegate)
- func (m *MockNetworkingServer) HookRemoveFromPeerStore(fn removeFromPeerStoreDelegate)
- func (m *MockNetworkingServer) HookRemoveTemporaryDial(fn removeTemporaryDialDelegate)
- func (m *MockNetworkingServer) HookTemporaryDialPeer(fn temporaryDialPeerDelegate)
- func (m *MockNetworkingServer) HookUpdatePendingConnCount(fn updatePendingConnCountDelegate)
- func (m *MockNetworkingServer) IsTemporaryDial(peerID peer.ID) bool
- func (m *MockNetworkingServer) NewDiscoveryClient(peerID peer.ID) (proto.DiscoveryClient, error)
- func (m *MockNetworkingServer) NewIdentityClient(peerID peer.ID) (proto.IdentityClient, error)
- func (m *MockNetworkingServer) RemoveFromPeerStore(peerInfo *peer.AddrInfo)
- func (m *MockNetworkingServer) RemoveTemporaryDial(peerID peer.ID)
- func (m *MockNetworkingServer) TemporaryDialPeer(peerAddrInfo *peer.AddrInfo)
- func (m *MockNetworkingServer) UpdatePendingConnCount(delta int64, direction network.Direction)
- type MockPeerMetrics
- func (m *MockPeerMetrics) HookLatencyEWMA(fn latencyEWMADelegate)
- func (m *MockPeerMetrics) HookRecordLatency(fn recordLatencyDelegate)
- func (m *MockPeerMetrics) HookRemoveMetricsPeer(fn removeMetricsPeerDelegate)
- func (m *MockPeerMetrics) LatencyEWMA(id peer.ID) time.Duration
- func (m *MockPeerMetrics) RecordLatency(id peer.ID, duration time.Duration)
- func (m *MockPeerMetrics) RemovePeer(id peer.ID)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockDiscoveryClient ¶
type MockDiscoveryClient struct {
// contains filtered or unexported fields
}
MockDiscoveryClient mocks a discovery client (other peer in the communication)
func (*MockDiscoveryClient) FindPeers ¶
func (mdc *MockDiscoveryClient) FindPeers( ctx context.Context, in *proto.FindPeersReq, opts ...grpc.CallOption, ) (*proto.FindPeersResp, error)
func (*MockDiscoveryClient) HookFindPeers ¶
func (mdc *MockDiscoveryClient) HookFindPeers(fn findPeersDelegate)
type MockIdentityClient ¶
type MockIdentityClient struct {
// contains filtered or unexported fields
}
MockIdentityClient mocks an identity client (other peer in the communication)
func (*MockIdentityClient) Hello ¶
func (mic *MockIdentityClient) Hello( ctx context.Context, in *proto.Status, opts ...grpc.CallOption, ) (*proto.Status, error)
func (*MockIdentityClient) HookHello ¶
func (mic *MockIdentityClient) HookHello(fn helloDelegate)
type MockNetworkingServer ¶
type MockNetworkingServer struct {
// contains filtered or unexported fields
}
func NewMockNetworkingServer ¶
func NewMockNetworkingServer() *MockNetworkingServer
func (*MockNetworkingServer) AddPeer ¶
func (m *MockNetworkingServer) AddPeer(id peer.ID, direction network.Direction)
func (*MockNetworkingServer) AddToPeerStore ¶
func (m *MockNetworkingServer) AddToPeerStore(peerInfo *peer.AddrInfo)
func (*MockNetworkingServer) CloseProtocolStream ¶
func (m *MockNetworkingServer) CloseProtocolStream(protocol string, peerID peer.ID) error
func (*MockNetworkingServer) DisconnectFromPeer ¶
func (m *MockNetworkingServer) DisconnectFromPeer(peerID peer.ID, reason string)
func (*MockNetworkingServer) EmitEvent ¶
func (m *MockNetworkingServer) EmitEvent(event *event.PeerEvent)
func (*MockNetworkingServer) FetchOrSetTemporaryDial ¶
func (m *MockNetworkingServer) FetchOrSetTemporaryDial(peerID peer.ID, newValue bool) bool
func (*MockNetworkingServer) GetBootnodeConnCount ¶
func (m *MockNetworkingServer) GetBootnodeConnCount() int64
func (*MockNetworkingServer) GetMockDiscoveryClient ¶
func (m *MockNetworkingServer) GetMockDiscoveryClient() *MockDiscoveryClient
func (*MockNetworkingServer) GetMockIdentityClient ¶
func (m *MockNetworkingServer) GetMockIdentityClient() *MockIdentityClient
func (*MockNetworkingServer) GetMockPeerMetrics ¶
func (m *MockNetworkingServer) GetMockPeerMetrics() *MockPeerMetrics
func (*MockNetworkingServer) GetPeerInfo ¶
func (m *MockNetworkingServer) GetPeerInfo(peerID peer.ID) *peer.AddrInfo
func (*MockNetworkingServer) GetRandomBootnode ¶
func (m *MockNetworkingServer) GetRandomBootnode() *peer.AddrInfo
func (*MockNetworkingServer) GetRandomPeer ¶
func (m *MockNetworkingServer) GetRandomPeer() *peer.ID
func (*MockNetworkingServer) HasFreeConnectionSlot ¶
func (m *MockNetworkingServer) HasFreeConnectionSlot(direction network.Direction) bool
func (*MockNetworkingServer) HookAddPeer ¶
func (m *MockNetworkingServer) HookAddPeer(fn addPeerDelegate)
func (*MockNetworkingServer) HookAddToPeerStore ¶
func (m *MockNetworkingServer) HookAddToPeerStore(fn addToPeerStoreDelegate)
func (*MockNetworkingServer) HookCloseProtocolStream ¶
func (m *MockNetworkingServer) HookCloseProtocolStream(fn closeProtocolStreamDelegate)
func (*MockNetworkingServer) HookDisconnectFromPeer ¶
func (m *MockNetworkingServer) HookDisconnectFromPeer(fn disconnectFromPeerDelegate)
func (*MockNetworkingServer) HookEmitEvent ¶
func (m *MockNetworkingServer) HookEmitEvent(fn emitEventDelegate)
func (*MockNetworkingServer) HookFetchAndSetTemporaryDial ¶
func (m *MockNetworkingServer) HookFetchAndSetTemporaryDial(fn fetchAndSetTemporaryDialDelegate)
func (*MockNetworkingServer) HookGetBootnodeConnCount ¶
func (m *MockNetworkingServer) HookGetBootnodeConnCount(fn getBootnodeConnCountDelegate)
func (*MockNetworkingServer) HookGetPeerInfo ¶
func (m *MockNetworkingServer) HookGetPeerInfo(fn getPeerInfoDelegate)
func (*MockNetworkingServer) HookGetRandomBootnode ¶
func (m *MockNetworkingServer) HookGetRandomBootnode(fn getRandomBootnodeDelegate)
func (*MockNetworkingServer) HookGetRandomPeer ¶
func (m *MockNetworkingServer) HookGetRandomPeer(fn getRandomPeerDelegate)
func (*MockNetworkingServer) HookHasFreeConnectionSlot ¶
func (m *MockNetworkingServer) HookHasFreeConnectionSlot(fn hasFreeConnectionSlotDelegate)
func (*MockNetworkingServer) HookIsTemporaryDial ¶
func (m *MockNetworkingServer) HookIsTemporaryDial(fn isTemporaryDialDelegate)
func (*MockNetworkingServer) HookNewDiscoveryClient ¶
func (m *MockNetworkingServer) HookNewDiscoveryClient(fn newDiscoveryClientDelegate)
func (*MockNetworkingServer) HookNewIdentityClient ¶
func (m *MockNetworkingServer) HookNewIdentityClient(fn newIdentityClientDelegate)
func (*MockNetworkingServer) HookRemoveFromPeerStore ¶
func (m *MockNetworkingServer) HookRemoveFromPeerStore(fn removeFromPeerStoreDelegate)
func (*MockNetworkingServer) HookRemoveTemporaryDial ¶
func (m *MockNetworkingServer) HookRemoveTemporaryDial(fn removeTemporaryDialDelegate)
func (*MockNetworkingServer) HookTemporaryDialPeer ¶ added in v0.6.1
func (m *MockNetworkingServer) HookTemporaryDialPeer(fn temporaryDialPeerDelegate)
func (*MockNetworkingServer) HookUpdatePendingConnCount ¶
func (m *MockNetworkingServer) HookUpdatePendingConnCount(fn updatePendingConnCountDelegate)
func (*MockNetworkingServer) IsTemporaryDial ¶
func (m *MockNetworkingServer) IsTemporaryDial(peerID peer.ID) bool
func (*MockNetworkingServer) NewDiscoveryClient ¶
func (m *MockNetworkingServer) NewDiscoveryClient(peerID peer.ID) (proto.DiscoveryClient, error)
func (*MockNetworkingServer) NewIdentityClient ¶
func (m *MockNetworkingServer) NewIdentityClient(peerID peer.ID) (proto.IdentityClient, error)
func (*MockNetworkingServer) RemoveFromPeerStore ¶
func (m *MockNetworkingServer) RemoveFromPeerStore(peerInfo *peer.AddrInfo)
func (*MockNetworkingServer) RemoveTemporaryDial ¶
func (m *MockNetworkingServer) RemoveTemporaryDial(peerID peer.ID)
func (*MockNetworkingServer) TemporaryDialPeer ¶ added in v0.6.1
func (m *MockNetworkingServer) TemporaryDialPeer(peerAddrInfo *peer.AddrInfo)
func (*MockNetworkingServer) UpdatePendingConnCount ¶
func (m *MockNetworkingServer) UpdatePendingConnCount(delta int64, direction network.Direction)
type MockPeerMetrics ¶
type MockPeerMetrics struct {
// contains filtered or unexported fields
}
MockPeerMetrics is a mock used by the Kademlia routing table
func (*MockPeerMetrics) HookLatencyEWMA ¶
func (m *MockPeerMetrics) HookLatencyEWMA(fn latencyEWMADelegate)
func (*MockPeerMetrics) HookRecordLatency ¶
func (m *MockPeerMetrics) HookRecordLatency(fn recordLatencyDelegate)
func (*MockPeerMetrics) HookRemoveMetricsPeer ¶
func (m *MockPeerMetrics) HookRemoveMetricsPeer(fn removeMetricsPeerDelegate)
func (*MockPeerMetrics) LatencyEWMA ¶
func (m *MockPeerMetrics) LatencyEWMA(id peer.ID) time.Duration
func (*MockPeerMetrics) RecordLatency ¶
func (m *MockPeerMetrics) RecordLatency(id peer.ID, duration time.Duration)
func (*MockPeerMetrics) RemovePeer ¶
func (m *MockPeerMetrics) RemovePeer(id peer.ID)
Click to show internal directories.
Click to hide internal directories.