discovery

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 16 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,
	ignoreCIDR ranger.Ranger,
	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) GetConfirmPeerInfo added in v1.2.4

func (d *DiscoveryService) GetConfirmPeerInfo(peerID peer.ID) *peer.AddrInfo

GetConfirmPeerInfo fetches the peer information (pass identity check)

func (*DiscoveryService) GetConfirmPeers added in v1.2.4

func (d *DiscoveryService) GetConfirmPeers() []peer.ID

GetConfirmPeers fetches the peers (pass identity check)

func (*DiscoveryService) HandleNetworkEvent

func (d *DiscoveryService) HandleNetworkEvent(peerEvent *event.PeerEvent)

HandleNetworkEvent handles base network events for the DiscoveryService

func (*DiscoveryService) RemovePeerFromRoutingTable added in v1.2.4

func (d *DiscoveryService) RemovePeerFromRoutingTable(peerID peer.ID)

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