discovery

package
v1.10.3-0...-b3aebb6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 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
	DHT             *dht.IpfsDHT
}

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

func (DHTConfig) GetLibp2pRawOptions

func (opt DHTConfig) GetLibp2pRawOptions() ([]libp2p_dht.Option, error)

GetLibp2pRawOptions get the raw libp2p options as a slice.

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(ctx context.Context, cancel context.CancelFunc, host libp2p_host.Host, dht *dht.IpfsDHT, 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