ethereumjs-monorepo

@ethereumjs/devp2p / DNS

Class: DNS

Table of contents

Constructors

Methods

Constructors

constructor

new DNS(options?)

Parameters

Name Type
options DNSOptions

Defined in

packages/devp2p/src/dns/dns.ts:27

Methods

__setNativeDNSModuleResolve

__setNativeDNSModuleResolve(mock): void

Only used for testing. A stopgap to enable successful TestDouble mocking of the native dns module.

Parameters

Name Type Description
mock any TestDouble fn

Returns

void

Defined in

packages/devp2p/src/dns/dns.ts:208


getPeers

getPeers(maxQuantity, dnsNetworks): Promise<PeerInfo[]>

Returns a list of verified peers listed in an EIP-1459 DNS tree. Method may return fewer peers than requested if maxQuantity is larger than the number of ENR records or the number of errors/duplicate peers encountered by randomized search exceeds maxQuantity plus the errorTolerance factor.

Parameters

Name Type Description
maxQuantity number max number to get
dnsNetworks string[] enrTree strings (See EIP-1459 for format)

Returns

Promise<PeerInfo[]>

Defined in

packages/devp2p/src/dns/dns.ts:45