discv5

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDiscV5Listener = errors.New("no discv5 listener")

Functions

This section is empty.

Types

type DiscoveryV5

type DiscoveryV5 struct {
	NAT nat.Interface
	// contains filtered or unexported fields
}

func NewDiscoveryV5

func NewDiscoveryV5(priv *ecdsa.PrivateKey, localnode *enode.LocalNode, peerConnector PeerConnector, log *zap.Logger, opts ...DiscoveryV5Option) (*DiscoveryV5, error)

func (*DiscoveryV5) FindPeersWithPredicate added in v0.7.0

func (d *DiscoveryV5) FindPeersWithPredicate(ctx context.Context, predicate func(*enode.Node) bool) (enode.Iterator, error)

func (*DiscoveryV5) FindPeersWithShard added in v0.7.0

func (d *DiscoveryV5) FindPeersWithShard(ctx context.Context, cluster, index uint16) (enode.Iterator, error)

func (*DiscoveryV5) IsStarted

func (d *DiscoveryV5) IsStarted() bool

func (*DiscoveryV5) Iterate added in v0.7.0

func (d *DiscoveryV5) Iterate(ctx context.Context, iterator enode.Iterator, onNode func(*enode.Node, peer.AddrInfo) error)

func (*DiscoveryV5) Iterator added in v0.4.0

func (d *DiscoveryV5) Iterator() (enode.Iterator, error)

get random nodes from DHT via discv5 listender used for caching enr address in peerExchange used for connecting to peers in discovery_connector

func (*DiscoveryV5) Node

func (d *DiscoveryV5) Node() *enode.Node

func (*DiscoveryV5) SetBootnodes

func (d *DiscoveryV5) SetBootnodes(nodes []*enode.Node) error

func (*DiscoveryV5) SetHost added in v0.6.0

func (d *DiscoveryV5) SetHost(h host.Host)

Sets the host to be able to mount or consume a protocol

func (*DiscoveryV5) Start

func (d *DiscoveryV5) Start(ctx context.Context) error

only works if the discovery v5 hasn't been started yet.

func (*DiscoveryV5) Stop

func (d *DiscoveryV5) Stop()

only works if the discovery v5 is in running state so we can assume that cancel method is set

type DiscoveryV5Option

type DiscoveryV5Option func(*discV5Parameters)

func DefaultOptions

func DefaultOptions() []DiscoveryV5Option

func WithAdvertiseAddr

func WithAdvertiseAddr(addr []multiaddr.Multiaddr) DiscoveryV5Option

func WithAutoFindPeers added in v0.7.0

func WithAutoFindPeers(find bool) DiscoveryV5Option

func WithAutoUpdate

func WithAutoUpdate(autoUpdate bool) DiscoveryV5Option

func WithBootnodes

func WithBootnodes(bootnodes []*enode.Node) DiscoveryV5Option

func WithPredicate added in v0.7.0

func WithPredicate(predicate func(*enode.Node) bool) DiscoveryV5Option

func WithUDPPort

func WithUDPPort(port uint) DiscoveryV5Option

type PeerConnector added in v0.4.0

type PeerConnector interface {
	PeerChannel() chan<- v2.PeerData
}

Jump to

Keyboard shortcuts

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