DnsSeedProviderOptionsType
Este conteúdo não está disponível em sua língua ainda.
DnsSeedProviderOptionsType =
object
Defined in: src/discovery/DnsSeedProviderOptions.ts:6
Plain options-object shape accepted by a DnsSeedProvider.
Properties
Section titled “Properties”cacheTtlMs?
Section titled “cacheTtlMs?”
readonlyoptionalcacheTtlMs?:number
Defined in: src/discovery/DnsSeedProviderOptions.ts:26
In-process TTL cache for DNS lookups. Deliberately not a
distributed cache — DNS resolution is a per-process concern, and a
Redis hop here would cost more than the lookup itself. Default:
60_000 ms. Set 0 to disable. Failures are NOT cached: a query
that throws will retry on the next call.
hostname
Section titled “hostname”
readonlyhostname:string
Defined in: src/discovery/DnsSeedProviderOptions.ts:8
Hostname to resolve (e.g. my-cluster.default.svc.cluster.local).
readonlyoptionallog?: (message,error?) =>void
Defined in: src/discovery/DnsSeedProviderOptions.ts:60
Reports addresses dropped by pinnedAddresses. Default: no-op — which makes a pin-list typo look exactly like an empty DNS answer, so wire this up in production.
Parameters
Section titled “Parameters”message
Section titled “message”string
error?
Section titled “error?”unknown
Returns
Section titled “Returns”void
pinnedAddresses?
Section titled “pinnedAddresses?”
readonlyoptionalpinnedAddresses?: readonlystring[]
Defined in: src/discovery/DnsSeedProviderOptions.ts:54
Addresses the resolver is allowed to hand back. Anything outside the list is discarded (and reported through log) instead of being offered to the cluster as a seed — a spoofed or hijacked DNS answer cannot point this node at a foreign peer. Unset means no pinning: every resolved address is accepted.
Entries come in two shapes, and which one applies depends on useSrv, because the two modes resolve to different things:
'10.0.0.0/8'— a CIDR. Matches the IPs that A-record mode returns.'svc.cluster.local'— a host suffix, matched on a label boundary. Matches the target hostnames SRV records carry (SRV mode never sees an IP, so a CIDR-only list would discard every legitimate answer).
Mixing both shapes is fine — a config shared between modes — but a list with nothing usable in the configured mode is rejected at construction time rather than silently discarding every seed.
A suffix pin is weaker than a CIDR pin: it constrains the namespace an SRV record may point into, but the A lookup of that target is still unpinned, so an attacker who owns the resolver outright is not stopped by it. It does stop the cheap attack — an injected record aimed at an unrelated domain.
readonlyport:number
Defined in: src/discovery/DnsSeedProviderOptions.ts:12
Port each discovered IP should be paired with.
resolve?
Section titled “resolve?”
readonlyoptionalresolve?: (hostname) =>Promise<string[]>
Defined in: src/discovery/DnsSeedProviderOptions.ts:14
Override the DNS-resolve function — defaults to node:dns/promises.
Parameters
Section titled “Parameters”hostname
Section titled “hostname”string
Returns
Section titled “Returns”Promise<string[]>
resolveSrv?
Section titled “resolveSrv?”
readonlyoptionalresolveSrv?: (hostname) =>Promise<object[]>
Defined in: src/discovery/DnsSeedProviderOptions.ts:16
When using SRV records, override resolveSrv similarly.
Parameters
Section titled “Parameters”hostname
Section titled “hostname”string
Returns
Section titled “Returns”Promise<object[]>
systemName
Section titled “systemName”
readonlysystemName:string
Defined in: src/discovery/DnsSeedProviderOptions.ts:10
System name to stamp on discovered NodeAddresses.
useSrv?
Section titled “useSrv?”
readonlyoptionaluseSrv?:boolean
Defined in: src/discovery/DnsSeedProviderOptions.ts:18
If true, prefer SRV records (which carry a port) over A.
