dnsdisc

package
v0.0.0-...-3debb8d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package dnsdisc implements node discovery via DNS (EIP-1459).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseURL

func ParseURL(url string) (domain string, pubkey *ecdsa.PublicKey, err error)

ParseURL parses an enrtree:// URL and returns its components.

Types

type Client

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

Client discovers nodes by querying DNS servers.

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a client.

func (*Client) NewIterator

func (c *Client) NewIterator(urls ...string) (enode.Iterator, error)

NewIterator creates an iterator that visits all nodes at the given tree URLs.

func (*Client) SyncTree

func (c *Client) SyncTree(url string) (*Tree, error)

SyncTree downloads the entire node tree at the given URL.

type Config

type Config struct {
	Timeout         time.Duration      // timeout used for DNS lookups (default 5s)
	RecheckInterval time.Duration      // time between tree root update checks (default 30min)
	CacheLimit      int                // maximum number of cached records (default 1000)
	RateLimit       float64            // maximum DNS requests / second (default 3)
	ValidSchemes