Documentation ¶
Overview ¶
Package mock_interfaces is a generated GoMock package.
Index ¶
- func NewDiscoveryListener(logger *logrus.Logger, addr net.Addr) interfaces.RPCListener
- func NewListener(logger *logrus.Logger, addr net.Addr) interfaces.RPCListener
- type DiscoveryListener
- type GossipFunc
- type Listener
- type MockP2PClient
- func (m *MockP2PClient) Close() error
- func (m *MockP2PClient) CloseChan() <-chan struct{}
- func (m *MockP2PClient) EXPECT() *MockP2PClientMockRecorder
- func (m *MockP2PClient) GetBlockHeaders(arg0 context.Context, arg1 *proto.GetBlockHeadersRequest, ...) (*proto.GetBlockHeadersResponse, error)
- func (m *MockP2PClient) GetMinedTxs(arg0 context.Context, arg1 *proto.GetMinedTxsRequest, arg2 ...grpc.CallOption) (*proto.GetMinedTxsResponse, error)
- func (m *MockP2PClient) GetPeers(arg0 context.Context, arg1 *proto.GetPeersRequest, arg2 ...grpc.CallOption) (*proto.GetPeersResponse, error)
- func (m *MockP2PClient) GetPendingTxs(arg0 context.Context, arg1 *proto.GetPendingTxsRequest, ...) (*proto.GetPendingTxsResponse, error)
- func (m *MockP2PClient) GetSnapShotNode(arg0 context.Context, arg1 *proto.GetSnapShotNodeRequest, ...) (*proto.GetSnapShotNodeResponse, error)
- func (m *MockP2PClient) GetSnapShotStateData(arg0 context.Context, arg1 *proto.GetSnapShotStateDataRequest, ...) (*proto.GetSnapShotStateDataResponse, error)
- func (m *MockP2PClient) GossipBlockHeader(arg0 context.Context, arg1 *proto.GossipBlockHeaderMessage, ...) (*proto.GossipBlockHeaderAck, error)
- func (m *MockP2PClient) GossipNextHeight(arg0 context.Context, arg1 *proto.GossipNextHeightMessage, ...) (*proto.GossipNextHeightAck, error)
- func (m *MockP2PClient) GossipNextRound(arg0 context.Context, arg1 *proto.GossipNextRoundMessage, ...) (*proto.GossipNextRoundAck, error)
- func (m *MockP2PClient) GossipPreCommit(arg0 context.Context, arg1 *proto.GossipPreCommitMessage, ...) (*proto.GossipPreCommitAck, error)
- func (m *MockP2PClient) GossipPreCommitNil(arg0 context.Context, arg1 *proto.GossipPreCommitNilMessage, ...) (*proto.GossipPreCommitNilAck, error)
- func (m *MockP2PClient) GossipPreVote(arg0 context.Context, arg1 *proto.GossipPreVoteMessage, ...) (*proto.GossipPreVoteAck, error)
- func (m *MockP2PClient) GossipPreVoteNil(arg0 context.Context, arg1 *proto.GossipPreVoteNilMessage, ...) (*proto.GossipPreVoteNilAck, error)
- func (m *MockP2PClient) GossipProposal(arg0 context.Context, arg1 *proto.GossipProposalMessage, ...) (*proto.GossipProposalAck, error)
- func (m *MockP2PClient) GossipTransaction(arg0 context.Context, arg1 *proto.GossipTransactionMessage, ...) (*proto.GossipTransactionAck, error)
- func (m *MockP2PClient) NodeAddr() interfaces.NodeAddr
- func (m *MockP2PClient) Status(arg0 context.Context, arg1 *proto.StatusRequest, arg2 ...grpc.CallOption) (*proto.StatusResponse, error)
- type MockP2PClientMockRecorder
- func (mr *MockP2PClientMockRecorder) Close() *gomock.Call
- func (mr *MockP2PClientMockRecorder) CloseChan() *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetBlockHeaders(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetMinedTxs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetPeers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetPendingTxs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetSnapShotNodes(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GetSnapShotStateData(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipBlockHeader(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipNextHeight(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipNextRound(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipPreCommit(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipPreCommitNil(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipPreVote(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipPreVoteNil(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipProposal(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) GossipTransaction(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockP2PClientMockRecorder) NodeAddr() *gomock.Call
- func (mr *MockP2PClientMockRecorder) Status(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- type MuxHandler
- type PeerLeaseFunc
- type PeerManager
- func (ps *PeerManager) Close() error
- func (ps *PeerManager) CloseChan() <-chan struct{}
- func (ps *PeerManager) Counts() (int, int)
- func (ps *PeerManager) GetPeers(ctx context.Context, req *pb.GetPeersRequest) (*pb.GetPeersResponse, error)
- func (ps *PeerManager) HandleP2PGetPeers(ctx context.Context, req *pb.GetPeersRequest) (*pb.GetPeersResponse, error)
- func (ps *PeerManager) PeeringComplete() bool
- func (ps *PeerManager) Start()
- func (ps *PeerManager) Status(smap map[string]interface{}) (map[string]interface{}, error)
- func (ps *PeerManager) Subscribe() interfaces.PeerSubscription
- type PeerSubscription
- func (p *PeerSubscription) CloseChan() <-chan struct{}
- func (p *PeerSubscription) GossipConsensus(hsh []byte, fn func(context.Context, interfaces.PeerLease) error)
- func (p *PeerSubscription) GossipTx(hsh []byte, fn func(context.Context, interfaces.PeerLease) error)
- func (p *PeerSubscription) PeerLease(ctx context.Context) (interfaces.PeerLease, error)
- func (p *PeerSubscription) PreventGossipConsensus(addr interfaces.NodeAddr, hsh []byte)
- func (p *PeerSubscription) PreventGossipTx(addr interfaces.NodeAddr, hsh []byte)
- func (p *PeerSubscription) RequestLease(ctx context.Context, msg []byte) (interfaces.PeerLease, error)
- type ServerHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDiscoveryListener ¶
func NewDiscoveryListener(logger *logrus.Logger, addr net.Addr) interfaces.RPCListener
NewDiscoveryListener returns a new Listener that conforms to the RPCListener interface.
func NewListener ¶
func NewListener(logger *logrus.Logger, addr net.Addr) interfaces.RPCListener
NewListener returns a new Listener that conforms to the RPCListener interface.
Types ¶
type DiscoveryListener ¶
type DiscoveryListener struct {
// contains filtered or unexported fields
}
DiscoveryListener allows a P2PConn to be converted into a net.Conn through the Accept method. This allows the injection of P2PConn objects into the grpc server through registering the Listener as the listener used by a grpc server.
func (*DiscoveryListener) Accept ¶
func (rpcl *DiscoveryListener) Accept() (net.Conn, error)
Accept allows Listener to implement net.Listener interface When called, Accept returns a net.Conn connection to the caller as new connections arrive.
func (*DiscoveryListener) Addr ¶
func (rpcl *DiscoveryListener) Addr() net.Addr
Addr allows Listener to implement net.Listener interface
func (*DiscoveryListener) Close ¶
func (rpcl *DiscoveryListener) Close() error
Close allows Listener to implement net.Listener interface Close also closes the Listener Accept method and raises an error to the caller of Accept.
func (*DiscoveryListener) NewConnection ¶
func (rpcl *DiscoveryListener) NewConnection(conn interfaces.P2PConn) error
NewConnection allows a P2PConn to be injected into the Listener such that the goroutine calling Accept will recv the P2PConn as a net.Conn
type GossipFunc ¶
type GossipFunc func(fn func(interfaces.PeerLease) error)
GossipFunc is a function to be passed in that allows the local node to gossip outbound messages. Use peerManager.Gossip
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener allows a P2PConn to be converted into a net.Conn through the Accept method. This allows the injection of P2PConn objects into the grpc server through registering the Listener as the listener used by a grpc server.
func (*Listener) Accept ¶
Accept allows Listener to implement net.Listener interface When called, Accept returns a net.Conn connection to the caller as new connections arrive.
func (*Listener) Close ¶
Close allows Listener to implement net.Listener interface Close also closes the Listener Accept method and raises an error to the caller of Accept.
func (*Listener) NewConnection ¶
func (rpcl *Listener) NewConnection(conn interfaces.P2PConn) error
NewConnection allows a P2PConn to be injected into the Listener such that the goroutine calling Accept will recv the P2PConn as a net.Conn
type MockP2PClient ¶
type MockP2PClient struct {
// contains filtered or unexported fields
}
MockP2PClient is a mock of P2PClient interface
func NewMockP2PClient ¶
func NewMockP2PClient(ctrl *gomock.Controller) *MockP2PClient
NewMockP2PClient creates a new mock instance
func (*MockP2PClient) CloseChan ¶
func (m *MockP2PClient) CloseChan() <-chan struct{}
CloseChan mocks base method
func (*MockP2PClient) EXPECT ¶
func (m *MockP2PClient) EXPECT() *MockP2PClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockP2PClient) GetBlockHeaders ¶
func (m *MockP2PClient) GetBlockHeaders(arg0 context.Context, arg1 *proto.GetBlockHeadersRequest, arg2 ...grpc.CallOption) (*proto.GetBlockHeadersResponse, error)
GetBlockHeaders mocks base method
func (*MockP2PClient) GetMinedTxs ¶
func (m *MockP2PClient) GetMinedTxs(arg0 context.Context, arg1 *proto.GetMinedTxsRequest, arg2 ...grpc.CallOption) (*proto.GetMinedTxsResponse, error)
GetMinedTxs mocks base method
func (*MockP2PClient) GetPeers ¶
func (m *MockP2PClient) GetPeers(arg0 context.Context, arg1 *proto.GetPeersRequest, arg2 ...grpc.CallOption) (*proto.GetPeersResponse, error)
GetPeers mocks base method
func (*MockP2PClient) GetPendingTxs ¶
func (m *MockP2PClient) GetPendingTxs(arg0 context.Context, arg1 *proto.GetPendingTxsRequest, arg2 ...grpc.CallOption) (*proto.GetPendingTxsResponse, error)
GetPendingTxs mocks base method
func (*MockP2PClient) GetSnapShotNode ¶
func (m *MockP2PClient) GetSnapShotNode(arg0 context.Context, arg1 *proto.GetSnapShotNodeRequest, arg2 ...grpc.CallOption) (*proto.GetSnapShotNodeResponse, error)
GetSnapShotNodes mocks base method
func (*MockP2PClient) GetSnapShotStateData ¶
func (m *MockP2PClient) GetSnapShotStateData(arg0 context.Context, arg1 *proto.GetSnapShotStateDataRequest, arg2 ...grpc.CallOption) (*proto.GetSnapShotStateDataResponse, error)
GetSnapShotLeaves mocks base method
func (*MockP2PClient) GossipBlockHeader ¶
func (m *MockP2PClient) GossipBlockHeader(arg0 context.Context, arg1 *proto.GossipBlockHeaderMessage, arg2 ...grpc.CallOption) (*proto.GossipBlockHeaderAck, error)
GossipBlockHeader mocks base method
func (*MockP2PClient) GossipNextHeight ¶
func (m *MockP2PClient) GossipNextHeight(arg0 context.Context, arg1 *proto.GossipNextHeightMessage, arg2 ...grpc.CallOption) (*proto.GossipNextHeightAck, error)
GossipNextHeight mocks base method
func (*MockP2PClient) GossipNextRound ¶
func (m *MockP2PClient) GossipNextRound(arg0 context.Context, arg1 *proto.GossipNextRoundMessage, arg2 ...grpc.CallOption) (*proto.GossipNextRoundAck, error)
GossipNextRound mocks base method
func (*MockP2PClient) GossipPreCommit ¶
func (m *MockP2PClient) GossipPreCommit(arg0 context.Context, arg1 *proto.GossipPreCommitMessage, arg2 ...grpc.CallOption) (*proto.GossipPreCommitAck, error)
GossipPreCommit mocks base method
func (*MockP2PClient) GossipPreCommitNil ¶
func (m *MockP2PClient) GossipPreCommitNil(arg0 context.Context, arg1 *proto.GossipPreCommitNilMessage, arg2 ...grpc.CallOption) (*proto.GossipPreCommitNilAck, error)
GossipPreCommitNil mocks base method
func (*MockP2PClient) GossipPreVote ¶
func (m *MockP2PClient) GossipPreVote(arg0 context.Context, arg1 *proto.GossipPreVoteMessage, arg2 ...grpc.CallOption) (*proto.GossipPreVoteAck, error)
GossipPreVote mocks base method
func (*MockP2PClient) GossipPreVoteNil ¶
func (m *MockP2PClient) GossipPreVoteNil(arg0 context.Context, arg1 *proto.GossipPreVoteNilMessage, arg2 ...grpc.CallOption) (*proto.GossipPreVoteNilAck, error)
GossipPreVoteNil mocks base method
func (*MockP2PClient) GossipProposal ¶
func (m *MockP2PClient) GossipProposal(arg0 context.Context, arg1 *proto.GossipProposalMessage, arg2 ...grpc.CallOption) (*proto.GossipProposalAck, error)
GossipProposal mocks base method
func (*MockP2PClient) GossipTransaction ¶
func (m *MockP2PClient) GossipTransaction(arg0 context.Context, arg1 *proto.GossipTransactionMessage, arg2 ...grpc.CallOption) (*proto.GossipTransactionAck, error)
GossipTransaction mocks base method
func (*MockP2PClient) NodeAddr ¶
func (m *MockP2PClient) NodeAddr() interfaces.NodeAddr
NodeAddr mocks base method
func (*MockP2PClient) Status ¶
func (m *MockP2PClient) Status(arg0 context.Context, arg1 *proto.StatusRequest, arg2 ...grpc.CallOption) (*proto.StatusResponse, error)
Status mocks base method
type MockP2PClientMockRecorder ¶
type MockP2PClientMockRecorder struct {
// contains filtered or unexported fields
}
MockP2PClientMockRecorder is the mock recorder for MockP2PClient
func (*MockP2PClientMockRecorder) Close ¶
func (mr *MockP2PClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockP2PClientMockRecorder) CloseChan ¶
func (mr *MockP2PClientMockRecorder) CloseChan() *gomock.Call
CloseChan indicates an expected call of CloseChan
func (*MockP2PClientMockRecorder) GetBlockHeaders ¶
func (mr *MockP2PClientMockRecorder) GetBlockHeaders(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetBlockHeaders indicates an expected call of GetBlockHeaders
func (*MockP2PClientMockRecorder) GetMinedTxs ¶
func (mr *MockP2PClientMockRecorder) GetMinedTxs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetMinedTxs indicates an expected call of GetMinedTxs
func (*MockP2PClientMockRecorder) GetPeers ¶
func (mr *MockP2PClientMockRecorder) GetPeers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetPeers indicates an expected call of GetPeers
func (*MockP2PClientMockRecorder) GetPendingTxs ¶
func (mr *MockP2PClientMockRecorder) GetPendingTxs(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetPendingTxs indicates an expected call of GetPendingTxs
func (*MockP2PClientMockRecorder) GetSnapShotNodes ¶
func (mr *MockP2PClientMockRecorder) GetSnapShotNodes(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetSnapShotNodes indicates an expected call of GetSnapShotNodes
func (*MockP2PClientMockRecorder) GetSnapShotStateData ¶
func (mr *MockP2PClientMockRecorder) GetSnapShotStateData(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetSnapShotLeaves indicates an expected call of GetSnapShotLeaves
func (*MockP2PClientMockRecorder) GossipBlockHeader ¶
func (mr *MockP2PClientMockRecorder) GossipBlockHeader(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipBlockHeader indicates an expected call of GossipBlockHeader
func (*MockP2PClientMockRecorder) GossipNextHeight ¶
func (mr *MockP2PClientMockRecorder) GossipNextHeight(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipNextHeight indicates an expected call of GossipNextHeight
func (*MockP2PClientMockRecorder) GossipNextRound ¶
func (mr *MockP2PClientMockRecorder) GossipNextRound(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipNextRound indicates an expected call of GossipNextRound
func (*MockP2PClientMockRecorder) GossipPreCommit ¶
func (mr *MockP2PClientMockRecorder) GossipPreCommit(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipPreCommit indicates an expected call of GossipPreCommit
func (*MockP2PClientMockRecorder) GossipPreCommitNil ¶
func (mr *MockP2PClientMockRecorder) GossipPreCommitNil(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipPreCommitNil indicates an expected call of GossipPreCommitNil
func (*MockP2PClientMockRecorder) GossipPreVote ¶
func (mr *MockP2PClientMockRecorder) GossipPreVote(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipPreVote indicates an expected call of GossipPreVote
func (*MockP2PClientMockRecorder) GossipPreVoteNil ¶
func (mr *MockP2PClientMockRecorder) GossipPreVoteNil(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipPreVoteNil indicates an expected call of GossipPreVoteNil
func (*MockP2PClientMockRecorder) GossipProposal ¶
func (mr *MockP2PClientMockRecorder) GossipProposal(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipProposal indicates an expected call of GossipProposal
func (*MockP2PClientMockRecorder) GossipTransaction ¶
func (mr *MockP2PClientMockRecorder) GossipTransaction(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GossipTransaction indicates an expected call of GossipTransaction
func (*MockP2PClientMockRecorder) NodeAddr ¶
func (mr *MockP2PClientMockRecorder) NodeAddr() *gomock.Call
NodeAddr indicates an expected call of NodeAddr
func (*MockP2PClientMockRecorder) Status ¶
func (mr *MockP2PClientMockRecorder) Status(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
Status indicates an expected call of Status
type MuxHandler ¶
type MuxHandler struct {
// contains filtered or unexported fields
}
MuxHandler allows a P2PMuxConn to be converted into a bidirectional grpc client and server connection. The server side connection is injected into an exiting grpc server running the P2P service and the client is bound against a the P2P service.
func NewMuxServerHandler ¶
func NewMuxServerHandler(logger *logrus.Logger, addr net.Addr, service interfaces.P2PServer) *MuxHandler
NewMuxServerHandler creates a new multiplexed grpc tunneling system for P2PMuxConn objects.
func (*MuxHandler) Close ¶
func (rpcm *MuxHandler) Close() error
Close will shutdown the server handler.
func (*MuxHandler) HandleConnection ¶
func (rpcm *MuxHandler) HandleConnection(conn interfaces.P2PMuxConn) (interfaces.P2PClient, error)
HandleConnection binds the P2PMuxConn to a grpc client and server. Internally this method uses the Initiator() method to determine if it should run the client or server side handshake. The only object returned is the P2PClient. The server side connection is handed off to the grpc server. Both the client and the server side connections may be shut down using the original P2PMuxConn Close method.
type PeerLeaseFunc ¶
type PeerLeaseFunc func(ctx context.Context) (interfaces.PeerLease, error)
PeerLeaseFunc is a function that takes in a context and returns a PeerLease object. The PeerLease object represents a peer with an active P2P connection. This object may be used to invoke requests against a remote peer.
type PeerManager ¶
PeerManager is a self contained system for management of peering. Other packages that need to send data to peers may subscribe to the peer manager and be notified of active peers. This notification occurs through the peer subscription system.
func NewPeerManager ¶
func NewPeerManager(p2pServer interfaces.P2PServer, chainID uint32, pLimMin int, pLimMax int, fwMode bool, fwHost, listenAddr, tprivk string) (*PeerManager, error)
NewPeerManager creates a new peer manager based on the Configuration values passed to the process.
func (*PeerManager) Close ¶
func (ps *PeerManager) Close() error
Close will shutdown the peer manager causing all transports and connections to be closed as well.
func (*PeerManager) CloseChan ¶
func (ps *PeerManager) CloseChan() <-chan struct{}
CloseChan returns a channel that is closed when the peerManager is shutting down.
func (*PeerManager) Counts ¶
func (ps *PeerManager) Counts() (int, int)
Counts returns the active and inactive peer counts
func (*PeerManager) GetPeers ¶
func (ps *PeerManager) GetPeers(ctx context.Context, req *pb.GetPeersRequest) (*pb.GetPeersResponse, error)
GetPeers is the handler for the get peers request.
func (*PeerManager) HandleP2PGetPeers ¶
func (ps *PeerManager) HandleP2PGetPeers(ctx context.Context, req *pb.GetPeersRequest) (*pb.GetPeersResponse, error)
HandleP2PGetPeers is the handler for the P2P method GetPeers
func (*PeerManager) PeeringComplete ¶
func (ps *PeerManager) PeeringComplete() bool
PeeringComplete returns true if the peering is complete for the node
func (*PeerManager) Start ¶
func (ps *PeerManager) Start()
Start launches the background loops of the peer manager
func (*PeerManager) Status ¶
func (ps *PeerManager) Status(smap map[string]interface{}) (map[string]interface{}, error)
Status returns the data needed for the status logger.
func (*PeerManager) Subscribe ¶
func (ps *PeerManager) Subscribe() interfaces.PeerSubscription
Subscribe returns a peer subscription. This allows the caller to have a remote copy of the active peer set for calling rpc methods on the peers without blocking the discovery system. The remote copy will update as peers are added and dropped, but any peer in the remote active set may have its connections closed at any time. Thus the caller should always gracefully handle communication failures.
type PeerSubscription ¶
PeerSubscription allows a remote service to maintain a reference to the active peer set. This reference will be kept in sync with the local copy of the active peer set and allows external services to perform P2P RPC with the active peers set.
func (*PeerSubscription) CloseChan ¶
func (p *PeerSubscription) CloseChan() <-chan struct{}
CloseChan returns a channel that will be closed when the subscription *BEGINS* shutdown
func (*PeerSubscription) GossipConsensus ¶
func (p *PeerSubscription) GossipConsensus(hsh []byte, fn func(context.Context, interfaces.PeerLease) error)
GossipConsensus allows a service to Gossip a consensus message to all active peers
func (*PeerSubscription) GossipTx ¶
func (p *PeerSubscription) GossipTx(hsh []byte, fn func(context.Context, interfaces.PeerLease) error)
GossipTx allows a service to Gossip a transaction all active peers
func (*PeerSubscription) PeerLease ¶
func (p *PeerSubscription) PeerLease(ctx context.Context) (interfaces.PeerLease, error)
PeerLease returns a random active peer
func (*PeerSubscription) PreventGossipConsensus ¶
func (p *PeerSubscription) PreventGossipConsensus(addr interfaces.NodeAddr, hsh []byte)
PreventGossipConsensus allows a peer to be marked as having knowledge of a message. This will prevent the peer from being spammed by stale gossip as well as allow the local node to request any associated data directly from the providing peer.
func (*PeerSubscription) PreventGossipTx ¶
func (p *PeerSubscription) PreventGossipTx(addr interfaces.NodeAddr, hsh []byte)
PreventGossipTx allows a peer to be marked as having knowledge of a message. This will prevent the peer from being spammed by stale gossip as well as allow the local node to request any associated data directly from the providing peer.
func (*PeerSubscription) RequestLease ¶
func (p *PeerSubscription) RequestLease(ctx context.Context, msg []byte) (interfaces.PeerLease, error)
RequestLease returns an active peer that has sent the requested msg
type ServerHandler ¶
type ServerHandler struct {
// contains filtered or unexported fields
}
ServerHandler binds a RPCListener to a grpc server such that the connections injected into the listener will be bound against the grpc server.
func NewBootNodeServerHandler ¶
func NewBootNodeServerHandler(logger *logrus.Logger, addr net.Addr, service interfaces.BootNodeServer) *ServerHandler
NewBootNodeServerHandler returns a RPC ServerHandler for the BootNode Service.
func NewDiscoveryServerHandler ¶
func NewDiscoveryServerHandler(logger *logrus.Logger, addr net.Addr, service interfaces.DiscoveryServer) *ServerHandler
NewDiscoveryServerHandler returns a RPC ServerHandler for the Discovery Service.
func (*ServerHandler) Close ¶
func (rpch *ServerHandler) Close() error
Close will shutdown the server handler.
func (*ServerHandler) HandleConnection ¶
func (rpch *ServerHandler) HandleConnection(conn interfaces.P2PConn) error
HandleConnection will inject the provided P2PConn into the NewConnection method of the bound RPCListener for consumption by the grpc server.