An open API service indexing awesome lists of open source software.

https://github.com/qwerty541/dns-bench

Find the fastest DNS in your location to improve internet browsing experience.
https://github.com/qwerty541/dns-bench

bench benchmarking command-line command-line-app command-line-tool commandline dns dns-benchmark dns-lookup dns-servers open-source performance-testing rust rust-crate rust-lang utility

Last synced: 9 months ago
JSON representation

Find the fastest DNS in your location to improve internet browsing experience.

Awesome Lists containing this project

README

          

# dns-bench

[![Crates.io version][crates-version-badge]][crates-url]
[![Crates.io downloads][crates-downloads-badge]][crates-url]
![Rust version][rust-version]
![License][license-badge]
[![Workflow Status][workflow-badge]][actions-url]

[crates-version-badge]: https://img.shields.io/crates/v/dns-bench.svg
[crates-downloads-badge]: https://img.shields.io/crates/d/dns-bench.svg
[crates-url]: https://crates.io/crates/dns-bench
[license-badge]: https://img.shields.io/crates/l/dns-bench.svg
[workflow-badge]: https://github.com/qwerty541/dns-bench/workflows/check/badge.svg
[actions-url]: https://github.com/qwerty541/dns-bench/actions
[rust-version]: https://img.shields.io/badge/rust-1.82.0%2B-lightgrey.svg?logo=rust

Table of contents

- [Description](#description)
- [Preview](#preview)
- [Image](#image)
- [Animation](#animation)
- [Features](#features)
- [🚀 Core Features](#-core-features)
- [⚙️ Configuration \& Flexibility](#️-configuration--flexibility)
- [📊 Output \& Usability](#-output--usability)
- [🐳 Platform \& Integration](#-platform--integration)
- [List of built-in DNS servers](#list-of-built-in-dns-servers)
- [Installation](#installation)
- [Which method to choose?](#which-method-to-choose)
- [From crates.io using Cargo](#from-cratesio-using-cargo)
- [From git repository using Cargo](#from-git-repository-using-cargo)
- [From Docker Hub](#from-docker-hub)
- [Executable file for Windows](#executable-file-for-windows)
- [Command-Line Reference](#command-line-reference)
- [Options](#options)
- [Subcommands](#subcommands)
- [License](#license)
- [Contribution](#contribution)

## Description

This repository provides a DNS benchmarking command-line tool written in Rust. It iterates through a built-in list of public DNS servers as well as automatically detected system DNS servers, measures their response times, and prints a table of sorted results in the console. You can use it to find the fastest DNS server for your location, improving your internet browsing experience. A preview, list of features, and the list of built-in DNS servers are provided below.

### Preview

#### Image

Preview image

#### Animation

Preview animation

### Features

#### 🚀 Core Features

- **Built-in list of public DNS servers**
Includes popular providers like Google, Cloudflare, Quad9, and more.
- **Automatic detection of system DNS servers**
Detects and highlights your system's configured DNS servers (Linux, Windows, macOS).
- **Multi-threaded benchmarking**
Runs benchmarks in parallel for faster results.

#### ⚙️ Configuration & Flexibility

- **Customizable request count, thread count, timeout, and domain**
Fine-tune how many requests, threads, and which domain to test.
- **Protocol and IP version selection**
Choose between UDP/TCP and IPv4/IPv6 for both lookup and connection.
- **Custom DNS server lists**
Use your own list of DNS servers instead of the built-in set.

#### 📊 Output & Usability

- **Multiple output formats**
Human-readable table, JSON, XML, or CSV for easy integration and analysis.
- **Configurable table styles**
Choose from various table styles for better readability.
- **Save favorite configurations**
Store your preferred settings in a config file for quick reuse.
- **Config file management without running benchmarks**
Use [subcommands](#subcommands) to manage your config independently from benchmarking.

#### 🐳 Platform & Integration

- **Docker support**
Run easily in a containerized environment (system DNS detection is skipped in Docker).
- **Cross-platform**
Works on Linux, Windows, and macOS.

### List of built-in DNS servers

- Google Public DNS
- Cloudflare
- Quad9
- ControlD
- OpenDNS
- CleanBrowsing
- AdGuard DNS

- Comodo Secure DNS
- Level3
- Verisign
- DNS.WATCH
- Norton ConnectSafe
- SafeDNS
- NextDNS

- Dyn
- Hurricane Electric
- Surfshark DNS
- SafeServe
- Vercara UltraDNS Public

## Installation

### Which method to choose?

- If you don't have Rust programming language environment installed on your machine, then you can choose between [installation from Docker Hub](#from-docker-hub) or [download the latest Windows executable file](#executable-file-for-windows).
- If you have Rust programming language environment installed on your machine, then you can choose between [installation from crates.io](#from-cratesio-using-cargo) or [installation from git repository](#from-git-repository-using-cargo).
- Installation from git repository is suitable only when you want to use the development version instead of the stable one or the crates.io service is unavailable.

### From crates.io using Cargo

Run the following command and wait until the crate is compiled:

```sh
$ cargo install dns-bench
```

Now you can run compiled binary:

```sh
$ dns-bench [OPTIONS]
```

### From git repository using Cargo

Run the following command and wait until the crate is compiled:

```sh
$ cargo install --git https://github.com/qwerty541/dns-bench.git --tag v0.11.0 dns-bench
```

Also you can remove tag option to install the latest development version.

Now you can run compiled binary:

```sh
$ dns-bench [OPTIONS]
```

### From Docker Hub

Run the following command to pull the image:

```sh
$ docker pull qwerty541/dns-bench:latest
```

Now you can run this tool inside the container:

```sh
$ docker run --rm -it --name dns-bench qwerty541/dns-bench:latest
```

If you want to pass some options, you can do it like this:

```sh
$ docker run --rm -it --name dns-bench qwerty541/dns-bench:latest /bin/bash -c "dns-bench --requests 20 --domain microsoft.com --style re-structured-text"
```

In case you want to use custom servers list, you have to mount the file with custom servers list to the container and pass the path to the file as an argument:

```sh
$ docker run --rm -it --name dns-bench --volume /home/alexandr/projects/dns-bench/examples/ipv4-custom-servers-example.txt:/ipv4-custom-servers-example.txt qwerty541/dns-bench:latest /bin/bash -c "dns-bench --custom-servers-file /ipv4-custom-servers-example.txt"
```

### Executable file for Windows

You can download the latest Windows executable file from the [releases page](https://github.com/qwerty541/dns-bench/releases/latest).

After downloading, open the command line, navigate to the directory where you saved the file, and run it with the following command:

```cmd
dns-bench.exe [OPTIONS]
```

> [!WARNING]
> The Windows executable file is not signed, so you may see a warning when running it. You can ignore this warning if you trust the source of the file. If you want to avoid this warning, you can build the crate from source using Rust programming language environment installed on your machine or use the Docker image as described above.

## Command-Line Reference

### Options

Below is a list of currently supported options.


Option
Description
Default value
Possible values



--domain
Domain to resolve.
google.com
Any domain


--threads
Number of threads to use.
8
1..256


--requests
Number of requests to each DNS server.
25
1..1000


--timeout
Timeout in seconds.
3
1..60


--protocol
Protocol to use.
udp
tcp, udp


--name-servers-ip
IP version to use for establishing connection.
v4
v4, v6


--lookup-ip
IP version to use for lookup.
v4
v4, v6


--style
Table style to use.
rounded
empty, blank, ascii, psql, markdown, modern, sharp, rounded, modern-rounded, extended, dots, re-structured-text, ascii-rounded


--save-config
Save the configurations to a file in users home directory.




--custom-servers-file
Provide a path to a file with custom servers list to use instead of built-in list. An example of file format can be found here for IPv4 and here for IPv6.




--format
Format of the output.
human-readable
human-readable, json, xml, csv


--skip-system-servers
Skip auto-detection of system DNS servers.



### Subcommands

Below is a list of currently supported subcommands.


Subcommand
Description



dns-bench config init
Create a config file with default values if it does not exist.


dns-bench config set [--key value ...]
Set one or more config values. Supports all options listed above.


dns-bench config reset
Reset config file to default values.


dns-bench config delete
Delete config file.

## License

Licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)

at your option.

## Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.