discv4

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: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

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
	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) 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
	LogErrors    bool
}

type Devp2pResult

type Devp2pResult struct {
	ConnectStartTime time.Time
	ConnectEndTime   time.Time
	ConnectError     error
	ConnectErrorStr  string
	Agent            string
	Protocols        []string
}

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 DiscV4Result

type DiscV4Result 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 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