tchivert 827e9fd8b9
docker / docker (push) Successful in 2m15s
update registry
2026-10-24 00:20:08 +02:00
2026-10-24 00:20:08 +02:00
2026-10-24 00:20:08 +02:00
2024-12-16 23:54:15 +01:00
2023-06-30 15:40:33 +02:00
2026-10-11 22:38:00 +00:00

rdns-go

rdns is a caching, forwarding DNS resolver written in Go. It acts as a DNS server, forwarding DNS queries to configured upstream nameservers and caching the responses.

Features

  • DNS responses caching
  • Roundrobin accross multiple DNS servers
  • DNS-over-TLS to reach the DNS servers
  • Blocklist, custom zones and hosts files
  • Prometheus metrics

Building

To build the rdns-go project, you need to have Go installed. Follow the official Go installation instructions for your operating system.

Once Go is installed, clone the rdns-go repository:

git clone https://git.rznet.fr/razian/rdns-go
cd rdns-go

Build the rdns binary:

go build

This will create a rdns binary in the project directory.

Usage

The rdns-go project can be started using the provided docker-compose.yml file. Modify the environment variables in the docker-compose.yml file to customize the configuration.

docker-compose up -d

This command will start the rdns-go container in the background.

On a host, install the packaged binary (see the release assets) or copy the binary and use the provided systemd unit in utils/services/rdns.service.

Configuration

The rdns-go project can be configured using the following command arguments:

  • -a (default: 0.0.0.0): The address to listen on. Use 127.0.0.1 for a machine-local resolver.
  • -p (default: 53): The port to listen on.
  • -b (default: none): The path to the blocklist file. This file contains a list of domain names to block.
  • -z (default: none): The path to the zones file. This file contains custom zone information.
  • -h (default: none): The path to the hosts file. This file contains custom hosts and can be used as a network wide /etc/hosts file.
  • -n (default: 9.9.9.9): The nameservers to use for DNS resolution, separated by : or ,.
  • -c (default: all CPUs): The number of CPUs to use.
  • -t (default: 10): The cache TTL for queries, in minutes.
  • -s (default: false): Whether to use TLS (DoT, port 853) to contact the resolver.
  • -l (default: false): Whether to enable query logging.
  • -m (default: false): Whether to enable Prometheus metrics on port 9153.

Utilities

The utils/ directory contains deployment helpers:

  • utils/blocklist_update: downloads and merges public blocklists into a single domain list. Generate the blocklist with utils/blocklist_update > conf/blocklist.txt (conf/blocklist.txt is generated data and is not stored in git).
  • utils/services/rdns.service: systemd unit running rdns as a local caching resolver.
  • utils/logrotate.d/rdns and utils/rsyslog.d/56-rdns.conf: log rotation and routing for the query log.

Acknowledgments

This project uses code from miekg/dns and patrickmn/go-cache.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

S
Description
Simple DNS proxy with blocklist, cache and custom zones handling
Readme MIT
17 MiB
1 Watchers 0 Forks
v1.7
Latest
2026-10-19 14:04:39 +00:00
Languages
Go 99%
Shell 0.7%
Dockerfile 0.3%