package dnsdisc
import "github.com/ethereum/go-ethereum/p2p/dnsdisc"
Package dnsdisc implements node discovery via DNS (EIP-1459).
Index ¶
- func ParseURL(url string) (domain string, pubkey *ecdsa.PublicKey, err error)
- type Client
- func NewClient(cfg Config) *Client
- func (c *Client) NewIterator(urls ...string) (enode.Iterator, error)
- func (c *Client) SyncTree(url string) (*Tree, error)
- type Config
- type Resolver
- type Tree
- func MakeTree(seq uint, nodes []*enode.Node, links []string) (*Tree, error)
- func (t *Tree) Links() []string
- func (t *Tree) Nodes() []*enode.Node
- func (t *Tree) Seq() uint
- func (t *Tree) SetSignature(pubkey *ecdsa.PublicKey, signature string) error
- func (t *Tree) Sign(key *ecdsa.PrivateKey, domain string) (url string, err error)
- func (t *Tree) Signature() string
- func (t *Tree) ToTXT(domain string) map[string]string
Functions ¶
func ParseURL ¶
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 ¶
NewClient creates a client.
func (*Client) NewIterator ¶
NewIterator creates an iterator that visits all nodes at the given tree URLs.
func (*Client) SyncTree ¶
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 enr.IdentityScheme // acceptable ENR identity schemes (default enode.ValidSchemes) Resolver Resolver // the DNS resolver to use (defaults to system DNS) Logger log.Logger // destination of client log messages (defaults to root logger) }
Config holds configuration options for the client.
type Resolver ¶
Resolver is a DNS resolver that can query TXT records.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a merkle tree of node records.
func MakeTree ¶
MakeTree creates a tree containing the given nodes and links.
func (*Tree) Links ¶
Links returns all links contained in the tree.
func (*Tree) Nodes ¶
Nodes returns all nodes contained in the tree.
func (*Tree) Seq ¶
Seq returns the sequence number of the tree.
func (*Tree) SetSignature ¶
SetSignature verifies the given signature and assigns it as the tree's current signature if valid.
func (*Tree) Sign ¶
Sign signs the tree with the given private key and sets the sequence number.
func (*Tree) Signature ¶
Signature returns the signature of the tree.
func (*Tree) ToTXT ¶
ToTXT returns all DNS TXT records required for the tree.
Source Files ¶
client.go doc.go error.go sync.go tree.go
- Version
- v1.16.1 (latest)
- Published
- Jul 2, 2025
- Platform
- linux/amd64
- Imports
- 24 packages
- Last checked
- 3 days ago –
Tools for package owners.