discovery

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

Jump to

Keyboard shortcuts

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