DNServer | DNS Server with Redis

Go Redis Docker DNS Protocol

Go DNS Server with Redis Caching

A lightweight DNS forwarding server built from scratch in Go, designed for efficient DNS query resolution with Redis as a caching layer.

Overview

This project implements the DNS protocol from the ground up in Go, forwarding queries to upstream DNS servers (Google DNS, Cloudflare) while caching results in Redis to minimize repeated requests and reduce latency.

Features

  • DNS Query Forwarding — Forwards DNS queries to configurable upstream DNS servers (e.g., Google DNS, Cloudflare DNS).
  • Redis Cache Integration — Caches DNS query results in Redis to minimize repeated requests and reduce latency.
  • DNS Compression Support — Efficiently handles DNS message compression as per the DNS protocol specification.
  • Configurable Upstream Servers — Allows customization of upstream DNS servers.
  • Dockerized Deployment — Fully containerized with Docker for easy setup and deployment.
  • Minimal Resource Consumption — Written in Go for optimal performance and efficiency.

Tech Stack

  • Language: Go
  • Caching: Redis
  • Infrastructure: Docker

Quick Start

# Clone the repository
git clone https://github.com/safiachraf/DNServer-with-Redis.git
cd DNServer-with-Redis

# Build and run with Docker
docker build -t dns-server .
docker run -p 53:53/udp -p 6379:6379 dns-server

Built from scratch to deeply understand the DNS protocol, network programming in Go, and caching strategies with Redis.