Skip to content

Commit 6eecefd

Browse files
BornToBeRootclaude
andcommitted
Feature: Refresh RDAP bootstrap files once a week
The IANA files rarely change, so they are now checked automatically once a week instead of daily (data.iana.org max-age). A longer server cache lifetime is still honored, and "Update now" checks immediately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0ab509f commit 6eecefd

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎Source/NETworkManager.Localization/Resources/Strings.Designer.cs‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Source/NETworkManager.Localization/Resources/Strings.resx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4593,7 +4593,7 @@ Cloudflare may log your IP address and network information. See Cloudflare's pri
45934593
<value>Handle</value>
45944594
</data>
45954595
<data name="HelpMessage_RDAPBootstrapFiles" xml:space="preserve">
4596-
<value>The IANA bootstrap files are used to find the RDAP server for a domain, IP address, AS number or entity. They are downloaded with the first query and refreshed automatically once a day.</value>
4596+
<value>The IANA bootstrap files are used to find the RDAP server for a domain, IP address, AS number or entity. They are downloaded with the first query and refreshed automatically once a week.</value>
45974597
</data>
45984598
<data name="HelpMessage_RDAPFollowReferral" xml:space="preserve">
45994599
<value>For many domains (e.g., .com and .net), the registry only returns basic data and refers to the RDAP server of the registrar for details. If enabled, the RDAP server of the registrar is queried as well.</value>

‎Source/NETworkManager.Models/RDAP/RDAPBootstrapService.cs‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public class RDAPBootstrapService : SingletonBase<RDAPBootstrapService>
4545
private const string StealthEndpointsResource = "NETworkManager.Models.Resources.RDAPStealthEndpoints.json";
4646

4747
/// <summary>
48-
/// Refresh interval if the server does not send caching headers. data.iana.org sends max-age=86400.
48+
/// Minimum interval for the automatic refresh. data.iana.org sends max-age=86400 (one day), but the files rarely
49+
/// change, so they are only checked once a week. "Update now" in the settings checks immediately.
4950
/// </summary>
50-
private static readonly TimeSpan DefaultMaxAge = TimeSpan.FromDays(1);
51+
private static readonly TimeSpan RefreshInterval = TimeSpan.FromDays(7);
5152

5253
private readonly HttpClient _client;
5354
private readonly SemaphoreSlim _semaphore = new(1, 1);
@@ -363,7 +364,9 @@ private async Task<bool> DownloadAsync(RDAPBootstrapCacheInfo info, string path,
363364
using var response = await _client.SendAsync(request, cancellationToken).ConfigureAwait(false);
364365

365366
info.LastChecked = DateTime.Now;
366-
info.Expires = DateTime.Now + GetMaxAge(response);
367+
var maxAge = GetMaxAge(response);
368+
369+
info.Expires = DateTime.Now + (maxAge > RefreshInterval ? maxAge.Value : RefreshInterval);
367370

368371
if (response.StatusCode == HttpStatusCode.NotModified && exists)
369372
{
@@ -452,17 +455,17 @@ private static async Task ReplaceFileAsync(string path, byte[] content, Cancella
452455
}
453456

454457
/// <summary>
455-
/// Gets the cache lifetime from the Cache-Control or Expires header (RFC 9224 8).
458+
/// Gets the cache lifetime from the Cache-Control or Expires header (RFC 9224 8), or null if there is none.
456459
/// </summary>
457-
private static TimeSpan GetMaxAge(HttpResponseMessage response)
460+
private static TimeSpan? GetMaxAge(HttpResponseMessage response)
458461
{
459462
if (response.Headers.CacheControl?.MaxAge is { } maxAge && maxAge > TimeSpan.Zero)
460463
return maxAge;
461464

462465
if (response.Content.Headers.Expires is { } expires && expires > DateTimeOffset.Now)
463466
return expires - DateTimeOffset.Now;
464467

465-
return DefaultMaxAge;
468+
return null;
466469
}
467470

468471
private void LoadCacheInfos(string cacheDirectory)

‎Website/docs/application/rdap.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RDAP is the standardized successor of Whois ([RFC 7480](https://www.rfc-editor.o
1212

1313
:::info
1414

15-
The RDAP server for a query is determined using the bootstrap files published by IANA at [data.iana.org/rdap](https://data.iana.org/rdap/). They are downloaded with the first query, cached locally and refreshed automatically once a day. See [Settings](#settings).
15+
The RDAP server for a query is determined using the bootstrap files published by IANA at [data.iana.org/rdap](https://data.iana.org/rdap/). They are downloaded with the first query, cached locally and refreshed automatically once a week. See [Settings](#settings).
1616

1717
- **Domains** are resolved via the registry of their top-level domain. Some registries (e.g. `.de`, `.ch`, `.li`, `.io`) run an RDAP server that is not (yet) listed by IANA; these are included in NETworkManager.
1818
- **Top-level domains** (e.g. `de`) are queried at the IANA root zone RDAP server (`rdap.iana.org`).

0 commit comments

Comments
 (0)