Skip to content

ppatrik-dev/dns-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNS Resolver with Domain Filtering

Author

Description

This project implements a custom DNS resolver with built-in domain filtering. It listens for incoming DNS queries from clients, checks them against a configurable blocklist, and either resolves allowed queries using upstream DNS server or filter blocked domains.

Features

  • Custom domain filtering based on a blocklist
  • Supports UDP DNS queries with A records
  • Fast domain filtering using a prefix tree
  • Dual-stack support for IPv4 and IPv6
  • Logs queries and filtered domains

Usage

Program options

./dns -s server [-p port] -f filter_file [-i version] [-r count] [-t time] [-d] [-v] [-h]
Option Description
-s server Specify the upstream DNS server to forward allowed queries.
-p port Optional. Port number the resolver listens on (default: 53).
-f filter_file Path to the file containing domains to block.
-i version Optional. Force IP version for upstream queries: 4 for IPv4, 6 for IPv6.
-r count Optional. Number of retransmits (default: 1).
-t time Optional. Time to wait for response (default: 500 ms).
-d Optional. Enable debug mode.
-v Optional. Enable verbose mode.
-h Print help message.

Example

./dns -s 8.8.8.8 -p 5353 -f blocked_domains.txt

Project structure

├── README              # Project description
├── Makefile            # Wrapper for gmake on BSD systems
├── real.mk             # Program build configuration
├── src/                # Source code files
├── include/            # Header files
│   └── dns/            
│   └── exceptions/
│   └── logger.hpp
└── tests/              # Project tests
│   └── query/
│   └── resolver/
│   └── trie/
│   └── test.sh
├── docs/               # Project documentation

License / Copyright

© 2025 Patrik Procházka.
All rights reserved. No part of this code may be copied, modified, or redistributed without explicit permission from the author.

About

DNS Resolver with Domain Filtering

Topics

Resources

Stars

Watchers

Forks

Contributors