Documentation ¶
Index ¶
- type DiscoveryService
- func (d *DiscoveryService) Close()
- func (d *DiscoveryService) ConnectToBootnodes(bootnodes []*peer.AddrInfo)
- func (d *DiscoveryService) FindPeers(ctx context.Context, req *proto.FindPeersReq) (*proto.FindPeersResp, error)
- func (d *DiscoveryService) HandleNetworkEvent(peerEvent *event.PeerEvent)
- func (d *DiscoveryService) RoutingTablePeers() []peer.ID
- func (d *DiscoveryService) RoutingTableSize() int
- func (d *DiscoveryService) Start()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoveryService ¶
type DiscoveryService struct { proto.UnimplementedDiscoveryServer // contains filtered or unexported fields }
DiscoveryService is a service that finds other peers in the network and connects them to the current running node
func NewDiscoveryService ¶
func NewDiscoveryService( server networkingServer, routingTable *kb.RoutingTable, logger hclog.Logger, ) *DiscoveryService
NewDiscoveryService creates a new instance of the discovery service
func (*DiscoveryService) Close ¶
func (d *DiscoveryService) Close()
Close stops the discovery service
func (*DiscoveryService) ConnectToBootnodes ¶
func (d *DiscoveryService) ConnectToBootnodes(bootnodes []*peer.AddrInfo)
ConnectToBootnodes attempts to connect to the bootnodes and add them to the peer / routing table
func (*DiscoveryService) FindPeers ¶
func (d *DiscoveryService) FindPeers( ctx context.Context, req *proto.FindPeersReq, ) (*proto.FindPeersResp, error)
FindPeers implements the proto service for finding the target's peers
func (*DiscoveryService) HandleNetworkEvent ¶
func (d *DiscoveryService) HandleNetworkEvent(peerEvent *event.PeerEvent)
HandleNetworkEvent handles base network events for the DiscoveryService
func (*DiscoveryService) RoutingTablePeers ¶
func (d *DiscoveryService) RoutingTablePeers() []peer.ID
RoutingTablePeers fetches the peers from the routing table
func (*DiscoveryService) RoutingTableSize ¶
func (d *DiscoveryService) RoutingTableSize() int
RoutingTableSize returns the size of the routing table
func (*DiscoveryService) Start ¶
func (d *DiscoveryService) Start()
Start starts the discovery service
Click to show internal directories.
Click to hide internal directories.