discv5

package
v0.0.0-...-7d840d9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCrawlRetriesAfterTimeout = 2 // magic

Variables

This section is empty.

Functions

This section is empty.

Types

type CrawlDriver

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

func NewCrawlDriver

func NewCrawlDriver(dbc db.Client, crawl *models.Crawl, 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
	TrackNeighbors bool
	DialTimeout    time.Duration
	BootstrapPeers []*enode.Node
	AddrDialType   config.AddrType
	AddrTrackType  config.AddrType
	KeepENR        bool
	MeterProvider  metric.MeterProvider
	TracerProvider trace.TracerProvider
	LogErrors      bool
}

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 {
	DialTimeout  time.Duration
	AddrDialType config.AddrType
	KeepENR      bool
	LogErrors    bool
}

type DialDriver

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

func NewDialDriver

func NewDialDriver(dbc *db.DBClient, 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 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 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 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 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 Libp2pResult

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

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) ID

func (p PeerInfo) ID() peer.ID

func (PeerInfo) Merge

func (p PeerInfo) Merge(other PeerInfo) PeerInfo

Jump to

Keyboard shortcuts

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