Repository navigation
Invert the DnsClient transport contract and split resolver settings out - #9122
Conversation
|
- `Transport.send` returns a `Reply` in a scope; the client closes the scope and applies its timeout, so a UDP to TCP retry shares one budget - Subtract the HTTP `Age` header from resource record TTLs (RFC 8484 §5.1) - Move `search`, `ndots`, `noAaaa`, and `hosts` from `DnsClient` to `layerDns(options)` - Add `NodeDnsClient.layerDns`, providing `Dns` and `DnsClient` from one options object, and default name servers to `dns.getServers()` - Make `Exchange.encode` default `udpPayloadSize` to 1232 bytes
bd6cb83 to
522d855
Compare
| const systemNameServers = (): ReadonlyArray<NetAddress.InetAddress> => { | ||
| let servers: ReadonlyArray<string> | ||
| try { | ||
| servers = NodeDnsApi.getServers() |
There was a problem hiding this comment.
Fixed in 795fb8b: the read is an Effect.sync now, with no try/catch, and explicit nameServers skip it.
|
Rationale for the changes in this PR, since the description only lists them. Why Why Why Why The Smaller items. Validation policy stays as it was (core |
Replace the try/catch around dns.getServers() with an Effect.sync, so the read happens when NodeDnsClient runs rather than in a plain function, and drop the catch: none of the runtimes throws from getServers(). Explicit nameServers still skip the read.
Stacked on #8962 (
feat/net-dns-over-https). Implements the API changes agreed in the design review of that PR.Transport.servers[].sendnow returnsEffect<Reply, DnsError, Scope>, withReply = { bytes, age? }. The client closes the scope and applies its timeout around everysend, so transports can no longer skip them.Exchangeis reduced toencode,matches, andfail. A UDP to TCP retry shares one timeout budget per server attempt, which is what theMakeOptionsdoc already described.Ageheader asReply.age, and the client subtracts it from resource record TTLs, floored at zero (RFC 8484 §5.1). OPT metadata and SOA timers are untouched.DnsClientis now{ query }.search,ndots,noAaaa, andhostsmove toDnsClient.layerDns(options?).NodeDnsClient.layerDns(options?)builds the transport, client, andDnsfrom the singleOptionsobject and providesDns.Dns | DnsClient.DnsClient. Its doc contrasts it withNodeDns.layer.NodeDnsClientdefaultsnameServerstodns.getServers(), deduplicated and without scoped IPv6 addresses, falling back to loopback when there are none.Exchange.encodedefaultsudpPayloadSizeto 1232 bytes, and theTransportHttpsOptionsdoc states that non-fetch clients do not follow redirects.Existing tests are updated to the new API; the Node integration suites now go through
NodeDnsClient.layerDns. No test covers theAgesubtraction yet.Closes EFF-2076