Skip to content

Repository files navigation

⚡ DNS Benchmarking Tool

A high-performance Python analytics suite for benchmarking filtered DNS services.
Measure block rates, latency, accuracy, and cache performance across dozens of providers.

Python 3.10+License: MITCode Style: Black

FeaturesQuick StartWorkflowsCLI ReferenceMetrics


🚀 Features

  • 🌐 Multi-Protocol Support — Native support for UDP, TCP, DNS over HTTPS (DoH), and DNS over TLS (DoT).
  • 🛡️ 50+ DNS Services — Pre-configured providers including Cloudflare, Google, Quad9, AdGuard, NextDNS, and more.
  • 🚫 Automated Blocklists — Auto-fetch from GitHub sources: StevenBlack, hagezi, OISD, AdGuard, Phishing Army.
  • 📊 Comprehensive Metrics — Block rate, False Positive rate, Precision, Recall, F1 score, Latency percentiles.
  • 📈 Advanced Visualization — Generate interactive HTML reports containing:
    • Radar Charts for multi-metric service comparison.
    • Protocol Comparison (UDP vs DoH vs DoT).
    • Error Rate Analysis & Success Distribution.
  • ⚡ Cache Analytics — Measure DNS cache hit rates, latency speedup (ms/%), and efficiency.
  • 🚀 Async Engine — Built on asyncio for high-concurrency queries with per-service rate limiting.

⚡ Quick Start

Installation

git clone https://github.com/DNSdecoded/ResolverLab.git
cd dns_benchmarking
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windowssource venv/bin/activate # Linux/macOS# Install dependencies
pip install -e .# Optional: Install kaleido for static PNG chart export
pip install "kaleido<=0.2.1"

Basic Usage

# 1. Fetch blocklists
python dns_benchmark.py fetch blocklists
# 2. Run quick test (10 domains)
python dns_benchmark.py test --quick
# 3. Open the generated HTML report in 'reports/'

🛠 Usage Workflows

GoalCommand
🚫 Adspython dns_benchmark.py test --categories ads --domains 200
🔒 Securitypython dns_benchmark.py test --categories malware --domains 500
👨‍👩‍👧 Familypython dns_benchmark.py test --categories adult gambling --domains 100
🏎 Speedpython dns_benchmark.py test --services "Cloudflare" "Google" --domains 50

Workflow 1: Compare Ad-Blocking DNS Services

Find the best ad-blocking DNS for your network:

python dns_benchmark.py fetch blocklists --categories ads
python dns_benchmark.py test \
--categories ads \
--domains 200 \
--services "AdGuard DNS""NextDNS""Mullvad Ad Block"

Workflow 2: Protocol Performance Battle

Compare the speed and reliability of DoH vs UDP:

python dns_benchmark.py test \
--services "Cloudflare DNS""Cloudflare DoH""Cloudflare DoT" \
--domains 100

> Check the "Protocol Comparison" chart in the generated HTML report.

Workflow 3: Full Stress Test

Test ALL services against ALL blocklists.

Warning

This scan performs thousands of queries and may take 10-20+ minutes depending on your connection.

python dns_benchmark.py fetch blocklists --all
python dns_benchmark.py test --all --domains 50
python dns_benchmark.py report generate --latest --format html json csv

📖 CLI Reference

📥 Blocklist Management
CommandDescription
fetch blocklistsDownload blocklists from configured sources
fetch blocklists --allFetch ALL configured categories
fetch blocklists --categories ads malwareFetch specific categories
fetch blocklists --refreshForce re-download (ignore cache)
fetch cache-infoShow cached blocklist information
fetch clear-cacheDelete cached blocklists
📡 DNS Services
CommandDescription
services listList all configured DNS services
services list --filtered-onlyShow only filtered DNS services
services test "Quad9 Filtered" example.comTest single query
services test "Google DoH" example.com -t AAAATest specific record type
🔥 Benchmark Execution
CommandDescription
testRun full benchmark with default settings
test --quickQuick test (10 domains)
test --allScan All: Test ALL services against ALL blocklists
test --categories ads --domains 200Custom benchmark
test --services "AdGuard DNS" "Quad9 Filtered"Specific services
test --no-baselineSkip baseline (unfiltered) comparison
📊 Reports & Analysis
CommandDescription
report listList previous benchmark runs
report generate --run-id 5Regenerate report from database
report generate --latest --format html jsonLatest run, multiple formats
report generate --latest --no-chartsGenerate report without charts
compare --baseline "Google" --targets "Quad9"Compare services directly

📉 Metrics Explained

MetricFormulaDescription
Block Rateblocked / totalPercentage of blocklist domains blocked
False Positive RateFP / (FP + TN)Legitimate domains incorrectly blocked (Lower is better)
PrecisionTP / (TP + FP)Accuracy of blocks (Low FP means High Precision)
F1 Score2 * (P * R) / (P + R)Harmonic mean of precision and recall
Cache Hit Rateimproved / eligible% of queries served faster than the baseline
Cache Speedupbaseline - latencyLatency saved by using the cache (ms and %)
Error Rateerrors / total% of queries that failed (Timeout, Connection Refused)

📂 Project Structure

dns_benchmarking/
├── config/ # ⚙️ Configuration
│ └── config.yaml
├── data/ # 💾 SQLite DB & Cache
├── reports/ # 📄 Generated Reports
└── src/
├── blocklist/ # List management
├── dns/ # Protocol engines (UDP/TCP/DoH/DoT)
├── testing/ # Benchmark logic
├── reporting/ # Charts & HTML generation
└── utils/ # Helpers

About

High-performance DNS benchmarking tool for evaluating filtered DNS providers across block accuracy, latency, cache behavior, and protocols (UDP, TCP, DoH, DoT).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages