DNS Resolver is a lightweight DNS resolver implemented in Go, designed for simplicity and efficiency.
- DNS Query Resolution: Resolves DNS queries using UDP.
- IPv4 Support: Capable of resolving IPv4 addresses.
- Timeout Handling: Includes timeout handling for queries to prevent blocking.
- Caching: Implements a caching mechanism to improve query response times.
- Go 1.18 or higher installed.
Clone the repository and navigate to the project directory:
git clone https://github.com/Harsh-2909/dns-resolver-go
cd dns-resolver-go
Build the project using Go:
go build
To run the DNS resolver, use the following command:
./dns-resolver <domain>
If you want to disable caching, use the --no-cache
flag:
./dns-resolver <domain> --no-cache
Unit tests are included to verify the functionality of the resolver. Run the tests with:
go test ./...
- IPv6 Support: Add support for IPv6 addresses.
- DNS Query Resolution: Add support for resolving DNS queries using TCP or HTTPS.
The DNS resolver takes in a domain name as a command-line argument. It then resolves the domain name using UDP and prints the IP addresses associated with the domain name.
The resolver sends a DNS query to the root servers at the start and then sends subsequent queries to the closest parent domain servers. The resolver stops sending queries when it receives an answer response from the nameservers.
To know more about how DNS works, I have written a blog post on the topic. You can find it here.
If you'd like to contribute to DNS Resolver, please fork the repository and submit a pull request. Feel free to open issues for bug reports, feature requests, or general feedback.
This project is licensed under the MIT License - see the LICENSE file for details.