Skip to content

realizino/DNSReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

DNSReader

A simple DNS server implementation in Java that can handle basic DNS queries and responses.

Description

DNSReader is a lightweight DNS server implementation that demonstrates the basic functionality of DNS (Domain Name System) protocol. It can handle DNS queries and respond with IP addresses for registered domain names.

Features

  • Basic DNS query handling
  • UDP-based communication
  • In-memory DNS record storage
  • Multi-threaded request processing
  • Support for A record type queries

Prerequisites

  • Java 17 or higher
  • Maven

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/DNSReader.git
cd DNSReader
  1. Build the project using Maven:
mvn clean install

Usage

  1. Run the DNS server:
java -jar target/DNSReader-1.0-SNAPSHOT.jar
  1. The server will start listening on port 53 (default DNS port)

  2. You can test the server using tools like dig or nslookup:

nslookup example.com localhost

Default DNS Records

The server comes with some sample DNS records pre-configured:

  • example.com → 93.184.216.34
  • localhost → 127.0.0.1
  • test.local → 192.168.1.10

Project Structure

DNSReader/
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── org/
│   │   │       └── example/
│   │   │           └── Main.java
│   │   └── resources/
│   └── test/
├── pom.xml
└── .gitignore

Technical Details

  • Uses Java's DatagramSocket for UDP communication
  • Implements basic DNS message parsing and response creation
  • Supports concurrent request handling through multi-threading
  • Uses a simple HashMap for DNS record storage

Limitations

This is a simplified DNS server implementation and has the following limitations:

  • Only supports A record type queries
  • Uses a fixed-size response buffer
  • Has limited error handling
  • Does not support DNS caching
  • No support for recursive queries

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages