discovery

package
v1.6.0-alpha.1-nomain Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolID = protocolPrefix + "/kad/1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery struct {
	// contains filtered or unexported fields
}

func New

func New(h DiscoveryHost, opts ...Opt) (*Discovery, error)

func (*Discovery) FindPeer added in v1.3.0

func (d *Discovery) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error)

func (*Discovery) Start

func (d *Discovery) Start() error

func (*Discovery) Stop

func (d *Discovery) Stop()

type DiscoveryHost added in v1.3.0

type DiscoveryHost interface {
	host.Host
	NeedPeerDiscovery() bool
	HaveRelay() bool
}

type Opt

type Opt func(*Discovery)

func AdvertiseForPeerDiscovery added in v1.3.0

func AdvertiseForPeerDiscovery() Opt

func DisableDHT added in v1.0.9

func DisableDHT() Opt

func EnableRoutingDiscovery added in v1.3.0

func EnableRoutingDiscovery() Opt

func Private

func Private() Opt

func WithAdvertiseDelay added in v1.3.6

func WithAdvertiseDelay(value time.Duration) Opt

func WithAdvertiseInterval added in v1.3.0

func WithAdvertiseInterval(value time.Duration) Opt

func WithAdvertiseIntervalSpread added in v1.4.5

func WithAdvertiseIntervalSpread(value time.Duration) Opt

func WithAdvertiseRetryDelay added in v1.3.6

func WithAdvertiseRetryDelay(value time.Duration) Opt

func WithBackup

func WithBackup(backup []peer.AddrInfo) Opt

func WithBootnodes

func WithBootnodes(bootnodes []peer.AddrInfo) Opt

func WithBootstrapDuration

func WithBootstrapDuration(bootstrapDuration time.Duration) Opt

func WithConnBackoffTimings added in v1.6.0

func WithConnBackoffTimings(minBackoff, maxBackoff, dialTimeout time.Duration) Opt

func WithDir

func WithDir(path string) Opt

func WithDiscoveryBackoff added in v1.6.0

func WithDiscoveryBackoff(backoff bool) Opt

func WithDiscoveryBackoffTimings added in v1.6.0

func WithDiscoveryBackoffTimings(minBackoff, maxBackoff time.Duration) Opt

func WithFindPeersRetryDelay added in v1.3.6

func WithFindPeersRetryDelay(value time.Duration) Opt

func WithHighPeers added in v1.0.8

func WithHighPeers(peers int) Opt

func WithLogger

func WithLogger(logger *zap.Logger) Opt

func WithMinPeers

func WithMinPeers(minPeers int) Opt

func WithMode added in v1.3.0

func WithMode(mode dht.ModeOpt) Opt

func WithPeriod

func WithPeriod(period time.Duration) Opt

func WithRelayCandidateChannel added in v1.3.0

func WithRelayCandidateChannel(relayCh chan<- peer.AddrInfo) Opt

func WithTimeout

func WithTimeout(timeout time.Duration) Opt

Jump to

Keyboard shortcuts

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