discovery

package
v0.0.0-...-3672da2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

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