discovery

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: LGPL-3.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 DHTConfig

type DHTConfig struct {
	BootNodes            []string
	DataStoreFile        *string // File path to store DHT data. Shall be only used for bootstrap nodes.
	DiscConcurrency      int
	DisablePrivateIPScan bool
}

DHTConfig is the configurable DHT options. For normal nodes, only BootNodes field need to be specified.

type Discovery

type Discovery interface {
	Start() error
	Close() error
	Advertise(ctx context.Context, ns string) (time.Duration, error)
	FindPeers(ctx context.Context, ns string, peerLimit int) (<-chan libp2p_peer.AddrInfo, error)
	GetRawDiscovery() discovery.Discovery
}

Discovery is the interface for the underlying peer discovery protocol. The interface is implemented by dhtDiscovery

func NewDHTDiscovery

func NewDHTDiscovery(host libp2p_host.Host, opt DHTConfig) (Discovery, error)

NewDHTDiscovery creates a new dhtDiscovery that implements Discovery interface.

Jump to

Keyboard shortcuts

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