discv5

package
v0.0.0-...-65580d4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCrawlRetriesAfterTimeout = 2 // magic

Variables

This section is empty.

Functions

This section is empty.

Types

type Cap

type Cap struct {
	Name    string
	Version uint
}

Cap is the structure of a peer capability.

func (Cap) String

func (c Cap) String() string

type CrawlDriver

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

func NewCrawlDriver

func NewCrawlDriver(dbc db.Client, cfg *CrawlDriverConfig) (*CrawlDriver, error)

func (*CrawlDriver) Close

func (d *CrawlDriver) Close()

func (*CrawlDriver) NewWorker

func (*CrawlDriver) NewWriter

func (*CrawlDriver) Tasks

func (d *CrawlDriver) Tasks() <-chan PeerInfo

type CrawlDriverConfig

type CrawlDriverConfig struct {
	Version           string
	Network           config.Network
	DialTimeout       time.Duration
	BootstrapPeers    []*enode.Node
	CrawlWorkerCount  int
	AddrDialType      config.AddrType
	KeepENR           bool
	MeterProvider     metric.MeterProvider
	TracerProvider    trace.TracerProvider
	LogErrors         bool
	UDPBufferSize     int
	UDPRespTimeout    time.Duration
	Discv5ProtocolID  [6]byte
	WakuClusterID     uint32
	WakuClusterShards []uint32
}

func (*CrawlDriverConfig) CrawlerConfig

func (cfg *CrawlDriverConfig) CrawlerConfig() *CrawlerConfig

func (*CrawlDriverConfig) WriterConfig

func (cfg *CrawlDriverConfig) WriterConfig() *core.CrawlWriterConfig

type Crawler

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

func (*Crawler) PeerProperties

func (c *Crawler) PeerProperties(node *enode.Node) map[string]any

func (*Crawler) Work

func (c *Crawler) Work(ctx context.Context, task PeerInfo) (core.CrawlResult[PeerInfo], error)

type CrawlerConfig

type CrawlerConfig struct {
	Network           config.Network
	DialTimeout       time.Duration
	AddrDialType      config.AddrType
	KeepENR           bool
	LogErrors         bool
	MaxJitter         time.Duration
	WakuClusterID     uint32
	WakuClusterShards []uint32
}

type DialDriver

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

func NewDialDriver

func NewDialDriver(dbc db.Client, cfg *DialDriverConfig) (*DialDriver, error)

func (*DialDriver) Close

func (d *DialDriver) Close()

func (*DialDriver) NewWorker

func (d *DialDriver) NewWorker() (core.Worker[PeerInfo, core.DialResult[PeerInfo]], error)

func (*DialDriver) NewWriter

func (*DialDriver) Tasks

func (d *DialDriver) Tasks() <-chan PeerInfo

type DialDriverConfig

type DialDriverConfig struct {
	Version string
}

type Dialer

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

Dialer encapsulates a libp2p host that dials peers.

func (*Dialer) Work

func (d *Dialer) Work(ctx context.Context, task PeerInfo) (core.DialResult[PeerInfo], error)

Work takes the PeerInfo object and tries to figure out if the peer is still online.

type DiscV5Result

type DiscV5Result struct {
	// The time we received the first successful response
	RespondedAt *time.Time

	// The multi address via which we received a response
	ConnectMaddr ma.Multiaddr

	// The updated ethereum node record
	ENR *enode.Node

	// The neighbors of the crawled peer
	RoutingTable *core.RoutingTable[PeerInfo]

	// The time the draining of bucket entries was finished
	DoneAt time.Time

	// The combined error of crawling the peer's buckets
	Error error

	// The above error mapped to a known string
	ErrorStr string
}

type ENREntryAttnets

type ENREntryAttnets struct {
	AttnetsNum int
	Attnets    string
}

func (*ENREntryAttnets) DecodeRLP

func (e *ENREntryAttnets) DecodeRLP(s *rlp.Stream) error

func (*ENREntryAttnets) ENRKey

func (e *ENREntryAttnets) ENRKey() string

type ENREntryBsc

type ENREntryBsc struct {
	Rest []rlp.RawValue `rlp:"tail"`
}

func (*ENREntryBsc) ENRKey

func (e *ENREntryBsc) ENRKey() string

type ENREntryCaps

type ENREntryCaps []Cap

func (ENREntryCaps) ENRKey

func (e ENREntryCaps) ENRKey() string

func (ENREntryCaps) Len

func (e ENREntryCaps) Len() int

func (ENREntryCaps) Less

func (e ENREntryCaps) Less(i, j int) bool

func (ENREntryCaps) Swap

func (e ENREntryCaps) Swap(i, j int)

type ENREntryEth

type ENREntryEth struct {
	ForkID forkid.ID
	Tail   []rlp.RawValue `rlp:"tail"`
}

func (*ENREntryEth) ENRKey

func (e *ENREntryEth) ENRKey() string

type ENREntryEth2

type ENREntryEth2 struct {
	beacon.Eth2Data
}

func (*ENREntryEth2) DecodeRLP

func (e *ENREntryEth2) DecodeRLP(s *rlp.Stream) error

func (*ENREntryEth2) ENRKey

func (e *ENREntryEth2) ENRKey() string

type ENREntryLes

type ENREntryLes struct {
	VfxVersion uint
	Rest       []rlp.RawValue `rlp:"tail"`
}

func (*ENREntryLes) ENRKey

func (e *ENREntryLes) ENRKey() string

type ENREntryOpStack

type ENREntryOpStack struct {
	ChainID uint64
	Version uint64
}

ENREntryOpStack from https://github.com/ethereum-optimism/optimism/blob/85d932810bafc9084613b978d42cd770bc044eb4/op-node/p2p/discovery.go#L172

func (*ENREntryOpStack) DecodeRLP

func (e *ENREntryOpStack) DecodeRLP(s *rlp.Stream) error

func (*ENREntryOpStack) ENRKey

func (e *ENREntryOpStack) ENRKey() string

type ENREntryOpera

type ENREntryOpera struct {
	ForkID forkid.ID
	Rest   []rlp.RawValue `rlp:"tail"`
}

func (*ENREntryOpera) ENRKey

func (e *ENREntryOpera) ENRKey() string

type ENREntryOptimism

type ENREntryOptimism struct {
	ChainID uint64
	Version uint64
}

func (*ENREntryOptimism) DecodeRLP

func (e *ENREntryOptimism) DecodeRLP(s *rlp.Stream) error

func (*ENREntryOptimism) ENRKey

func (e *ENREntryOptimism) ENRKey() string

type ENREntryPtStack

type ENREntryPtStack struct {
	ChainID uint64
	Version uint64
}

func (*ENREntryPtStack) DecodeRLP

func (e *ENREntryPtStack) DecodeRLP(s *rlp.Stream) error

func (*ENREntryPtStack) ENRKey

func (e *ENREntryPtStack) ENRKey() string

type ENREntrySnap

type ENREntrySnap struct {
	Rest []rlp.RawValue `rlp:"tail"`
}

func (*ENREntrySnap) ENRKey

func (e *ENREntrySnap) ENRKey() string

type ENREntrySyncCommsSubnet

type ENREntrySyncCommsSubnet struct {
	SyncNets string
}

func (*ENREntrySyncCommsSubnet) DecodeRLP

func (e *ENREntrySyncCommsSubnet) DecodeRLP(s *rlp.Stream) error

func (*ENREntrySyncCommsSubnet) ENRKey

func (e *ENREntrySyncCommsSubnet) ENRKey() string

type ENREntryTestID

type ENREntryTestID []byte

func (ENREntryTestID) ENRKey

func (e ENREntryTestID) ENRKey() string

type ENREntryTrust

type ENREntryTrust struct {
	Rest []rlp.RawValue `rlp:"tail"`
}

func (*ENREntryTrust) ENRKey

func (e *ENREntryTrust) ENRKey() string

type Libp2pResult

type Libp2pResult struct {
	ConnectStartTime      time.Time
	ConnectEndTime        time.Time
	ConnectError          error
	ConnectErrorStr       string
	DialMaddrs            []ma.Multiaddr
	ConnectMaddr          ma.Multiaddr
	Agent                 string
	Protocols             []string
	ListenMaddrs          []ma.Multiaddr
	ConnClosedImmediately bool // whether conn was no error but still unconnected
	GenTCPAddr            bool // whether a TCP address was generated
	WakuClusterID         uint32
	WakuClusterShards     []uint32
}

type PeerInfo

type PeerInfo struct {
	*enode.Node
	// contains filtered or unexported fields
}

func NewPeerInfo

func NewPeerInfo(node *enode.Node) (PeerInfo, error)

func (PeerInfo) Addrs

func (p PeerInfo) Addrs() []ma.Multiaddr

func (PeerInfo) DeduplicationKey

func (p PeerInfo) DeduplicationKey() string

func (PeerInfo) DiscoveryPrefix

func (p PeerInfo) DiscoveryPrefix() uint64

func (PeerInfo) ID

func (p PeerInfo) ID() peer.ID

func (PeerInfo) Merge

func (p PeerInfo) Merge(other PeerInfo) PeerInfo

func (PeerInfo) UDPMaddr

func (p PeerInfo) UDPMaddr() ma.Multiaddr

Jump to

Keyboard shortcuts

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