dns-over-https icon indicating copy to clipboard operation
dns-over-https copied to clipboard

Feature: cache

Open gdm85 opened this issue 4 years ago • 1 comments

This is the caching feature that I developed some time and have been using for a while now; it has to be considered experimental.

Please review the code looking for bugs/wrong assumptions or something to improve.

gdm85 avatar May 13 '21 17:05 gdm85

I have some suggestions about caching: (The complexity of caching is also the reason why I haven't implement cache)

  1. EDNS-Subnet shouldn't be stripped, the user's IP address masked with the scope field in the response should be used as a part of the cache key. This is to help deliver location-relevant results.
  2. Before the request has yet received a response, the user's IP address masked with the mask field in the request can be used as the key to mark an in-flight or failed request.
  3. The cache can also help deduplicate incoming requests -- same requests sent from similar IP addresses are grouped together. Only one sequence of requests is forwarded to upstream, effectively preventing retransmission storm.
  4. The internal of this software is done on the JSON level, since the software is originally designed for Google JSON protocol, before IETF DoH was a thing. Therefore, it might be easier to do caching at JSON level: I have already parsed those binary into human-readable thing and converted TTL to absolute time. Also this awesome new feature will automatically be compatible with both protocols.

m13253 avatar May 13 '21 21:05 m13253