discv5

package
v0.2.3-test Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPeersToDiscover = 600

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryV5

type DiscoveryV5 struct {
	sync.RWMutex

	discovery.Discovery

	NAT nat.Interface
	// contains filtered or unexported fields
}

func NewDiscoveryV5

func NewDiscoveryV5(ctx context.Context, host host.Host, priv *ecdsa.PrivateKey, localnode *enode.LocalNode, log *zap.Logger, opts ...DiscoveryV5Option) (*DiscoveryV5, error)

func (*DiscoveryV5) Advertise

func (d *DiscoveryV5) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error)

func (*DiscoveryV5) FindNodes

func (d *DiscoveryV5) FindNodes(ctx context.Context, topic string, opts ...discovery.Option) ([]PeerRecord, error)

func (*DiscoveryV5) FindPeers

func (d *DiscoveryV5) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*DiscoveryV5) IsStarted

func (d *DiscoveryV5) IsStarted() bool

func (*DiscoveryV5) Node

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

func (*DiscoveryV5) Start

func (d *DiscoveryV5) Start() error

func (*DiscoveryV5) Stop

func (d *DiscoveryV5) Stop()

type DiscoveryV5Option

type DiscoveryV5Option func(*discV5Parameters)

func DefaultOptions

func DefaultOptions() []DiscoveryV5Option

func WithAdvertiseAddr

func WithAdvertiseAddr(addr net.IP) DiscoveryV5Option

func WithAutoUpdate

func WithAutoUpdate(autoUpdate bool) DiscoveryV5Option

func WithBootnodes

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

func WithUDPPort

func WithUDPPort(port int) DiscoveryV5Option

type PeerRecord

type PeerRecord struct {
	Peer peer.AddrInfo
	Node enode.Node
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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