Skip to content

A light weight DNS resolver over UDP to resolve IPv4 addresses of a domain written in Golang

License

Notifications You must be signed in to change notification settings

Harsh-2909/dns-resolver-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNS Resolver

GitHub GitHub go.mod Go version Go Report Card GitHub Workflow Status

DNS Resolver

DNS Resolver is a lightweight DNS resolver implemented in Go, designed for simplicity and efficiency.

Features

  • 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.

Getting Started

Prerequisites

  • Go 1.18 or higher installed.

Building

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

Running

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

Testing

Unit tests are included to verify the functionality of the resolver. Run the tests with:

go test ./...

Features to be added

  • IPv6 Support: Add support for IPv6 addresses.
  • DNS Query Resolution: Add support for resolving DNS queries using TCP or HTTPS.

Usage

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.

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A light weight DNS resolver over UDP to resolve IPv4 addresses of a domain written in Golang

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages