DnsSeedProvider
Ce contenu n’est pas encore disponible dans votre langue.
Defined in: src/discovery/DnsSeedProvider.ts:27
Seed provider backed by DNS. Default mode resolves A records and pairs
each IP with the configured port; SRV mode picks up name:port directly.
The actual DNS functions are injected via options so tests can stub them
without touching the network. The real impl uses node:dns/promises.
TTL cache: repeated lookups inside the configured cacheTtlMs
window are served from a per-instance in-memory cache, halving the
DNS load on large clusters where each node polls the same name.
Address pinning (#145): whatever DNS says is, by construction, an
answer from a party this node did not authenticate. With
pinnedAddresses set, resolved addresses outside the list are dropped
before they ever reach the cluster. This is defence in depth, not the
primary control — mTLS is (a peer’s certificate must vouch for the
address it claims, see cluster/PeerIdentity). It matters precisely
where mTLS is not configured, and as a second layer where it is.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DnsSeedProvider(
options?):DnsSeedProvider
Defined in: src/discovery/DnsSeedProvider.ts:35
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”DnsSeedProvider
Methods
Section titled “Methods”invalidateCacheForTest()
Section titled “invalidateCacheForTest()”invalidateCacheForTest():
void
Defined in: src/discovery/DnsSeedProvider.ts:56
Test hook — drop the cached entry so the next lookup() re-queries DNS.
Returns
Section titled “Returns”void
lookup()
Section titled “lookup()”lookup():
Promise<NodeAddress[]>
Defined in: src/discovery/DnsSeedProvider.ts:43
Return candidate seed addresses.
Returns
Section titled “Returns”Promise<NodeAddress[]>
