[PR #484] [MERGED] resolver: Add config in ResolverOpts to set an optional minimum TTL for cached records #1475

Closed
opened 2026-03-16 02:08:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/484
Author: @hawkw
Created: 5/22/2018
Status: Merged
Merged: 5/25/2018
Merged by: @bluejekyll

Base: masterHead: eliza/min-ttls


📝 Commits (9)

  • b146394 resolver: Add optional minimum TTL to DnsLru
  • 97732ad resolver: Add optional cache_min_ttl configuration to ResolverOpts
  • 4be6c52 resolver: Test the TTLs of lookups returned by a cache with a min TTL
  • def13b0 resolver: Add separate minimum TTLs for positive and negative responses
  • fef5f93 resolver: Configure DnsLru min TTLs with a builder
  • 7ca595e Merge branch 'master' into eliza/min-ttls
  • bf74a6e resolver: replace LruBuilder with a TtlConfig struct
  • 9de5612 resolver: make use of default cache TTLs explicit
  • 1acd4da Merge branch 'master' into eliza/min-ttls

📊 Changes

5 files changed (+164 additions, -25 deletions)

View changed files

📝 resolver/src/config.rs (+12 -0)
📝 resolver/src/dns_lru.rs (+124 -10)
📝 resolver/src/lookup_state.rs (+11 -11)
📝 resolver/src/resolver.rs (+9 -2)
📝 resolver/src/resolver_future.rs (+8 -2)

📄 Description

This PR adds an optional cache_min_ttl field to ResolverOpts, which, if
set, will cause the underlying DnsLru cache to limit all TTLs to that minimum
value. Queries with records whose TTL is under the minimum will have their TTL
set to the minimum value instead.

We want the ability to set a minimum TTL for DNS responses in Conduit so as to
limit the rate at which the Conduit proxy queries DNS in development mode
(see runconduit/conduit#711). I originally implemented this functionality in the
Conduit proxy, but @briansmith suggested that it should be implemented in
Trust-DNS, instead.

Signed-off-by: Eliza Weisman eliza@buoyant.io


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/484 **Author:** [@hawkw](https://github.com/hawkw) **Created:** 5/22/2018 **Status:** ✅ Merged **Merged:** 5/25/2018 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `master` ← **Head:** `eliza/min-ttls` --- ### 📝 Commits (9) - [`b146394`](https://github.com/hickory-dns/hickory-dns/commit/b146394a21cd76ab35c86b7c97947fc0b9c45cc7) resolver: Add optional minimum TTL to DnsLru - [`97732ad`](https://github.com/hickory-dns/hickory-dns/commit/97732ad811620bdef7b4493e3540aab674b07c76) resolver: Add optional `cache_min_ttl` configuration to ResolverOpts - [`4be6c52`](https://github.com/hickory-dns/hickory-dns/commit/4be6c52d026e55cb6b00bbf9dfe8c7677811186f) resolver: Test the TTLs of lookups returned by a cache with a min TTL - [`def13b0`](https://github.com/hickory-dns/hickory-dns/commit/def13b00833525c026626cb400c96c7efde0bf66) resolver: Add separate minimum TTLs for positive and negative responses - [`fef5f93`](https://github.com/hickory-dns/hickory-dns/commit/fef5f93c11a6e46e2e4e5aae5245ea00e0e3de2b) resolver: Configure DnsLru min TTLs with a builder - [`7ca595e`](https://github.com/hickory-dns/hickory-dns/commit/7ca595ecde262fb0905afd92933f1cae4aee0d35) Merge branch 'master' into eliza/min-ttls - [`bf74a6e`](https://github.com/hickory-dns/hickory-dns/commit/bf74a6e4fb417c2d232d289aaf7905d36a6631d5) resolver: replace LruBuilder with a TtlConfig struct - [`9de5612`](https://github.com/hickory-dns/hickory-dns/commit/9de5612cc74d53e80635d23ee808b45586f4f420) resolver: make use of default cache TTLs explicit - [`1acd4da`](https://github.com/hickory-dns/hickory-dns/commit/1acd4daaac8100014c3ef253ea6928eb706071de) Merge branch 'master' into eliza/min-ttls ### 📊 Changes **5 files changed** (+164 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `resolver/src/config.rs` (+12 -0) 📝 `resolver/src/dns_lru.rs` (+124 -10) 📝 `resolver/src/lookup_state.rs` (+11 -11) 📝 `resolver/src/resolver.rs` (+9 -2) 📝 `resolver/src/resolver_future.rs` (+8 -2) </details> ### 📄 Description This PR adds an optional `cache_min_ttl` field to `ResolverOpts`, which, if set, will cause the underlying `DnsLru` cache to limit all TTLs to that minimum value. Queries with records whose TTL is under the minimum will have their TTL set to the minimum value instead. We want the ability to set a minimum TTL for DNS responses in Conduit so as to limit the rate at which the Conduit proxy queries DNS in development mode (see runconduit/conduit#711). I originally implemented this functionality in the Conduit proxy, but @briansmith [suggested](https://github.com/runconduit/conduit/pull/974#pullrequestreview-122330772) that it should be implemented in Trust-DNS, instead. Signed-off-by: Eliza Weisman <eliza@buoyant.io> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 02:08:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#1475
No description provided.