From 5a617fc0b7400db3a54347224acd99c742b476e9 Mon Sep 17 00:00:00 2001 From: vintagecircuit <77209314+vintagecircuit@users.noreply.github.com> Date: Wed, 13 Sep 2023 19:33:46 -0400 Subject: [PATCH] README.md --- README.md | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1fc8698..ea97858 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,30 @@ ## Description -The DoHClient module in Python performs reverse DNS lookups for IPv4 addresses via DNS over HTTPS (DoH) using the Quad9 DoH endpoint. It includes caching and logging functionalities for efficiency and easier debugging. **Note: This module currently only supports IPv4 addresses.** +The DoHClient module performs reverse DNS lookups for IPv4 addresses via DNS over HTTPS (DoH) using the Quad9 DoH endpoint. It includes caching and logging functionalities for efficiency and easier debugging. + +**Note**: This module currently only supports IPv4 addresses. + +## Table of Contents + +- [Features](#features) +- [Installation](#installation) +- [Usage](#usage) +- [Components](#components) + - [DoHClient](#dohclient) + - [Cache](#cache) + - [Logging](#logging) +- [Contributing](#contributing) +- [License](#license) + +## Features + +- IPv4 Support: This module is currently limited to IPv4 addresses. +- Uses Quad9 DoH Endpoint for DNS lookups. +- Caches DNS lookups for faster repeated queries. +- Validates IPv4 addresses. +- Includes retries for failed requests. +- Logs events and errors using Python's logging module. ## Installation @@ -41,14 +64,18 @@ This module uses a custom logging module called `doh_logger`. Please make sure y The caching duration is set to 5 minutes by default and can be modified by changing the `CACHE_DURATION` static variable in the `DoHClient` class. -## Features +## Classes + +### DoHClient + +The `DoHClient` class performs reverse DNS lookups for IPv4 addresses. It also includes a caching mechanism to minimize network requests. For more details, refer to the code documentation. + +### Cache + +The `Cache` class is a Least Recently Used (LRU) cache that stores DNS lookups for a specified duration. The cache supports a maximum size and automatically evicts the oldest or stale entries based on size and time. -- **IPv4 Support**: This module is currently limited to IPv4 addresses. -- Uses the Quad9 DoH Endpoint for DNS lookups -- Caches DNS lookups for faster repeated queries -- Validates IPv4 addresses -- Includes retries for failed requests -- Logs events and errors +- **Eviction Based on Time**: The cache removes entries that are older than a specified duration. +- **Eviction Based on Size**: The cache maintains its size by removing the oldest entries when a new entry is added and the cache is full. ## Contributing