Categorygithub.com/44670/SimpleDNS
repositorypackage
0.0.0-20230415043337-5204c7885822
Repository: https://github.com/44670/simpledns.git
Documentation: pkg.go.dev

# README

SimpleDNS

SimpleDNS is a lightweight and easy-to-use DNS server written in Go. It listens for incoming UDP packets, resolves domain names using DoH (DNS over HTTPS) services, and supports IPv4 results. The server is designed to handle basic A record queries and can be configured using a JSON file.

Features

  • Listen for and respond to incoming UDP packets
  • Resolve domain names using DoH services
  • Support IPv4 results
  • Handle basic A record queries
  • Load configuration from a JSON file
  • Custom domain resolution rules with wildcard support for subdomains

Installation

  1. Install Go
  2. Clone the repository:
git clone https://github.com/44670/SimpleDNS
  1. Change to the SimpleDNS directory:
cd SimpleDNS
  1. Build the binary:
go build

Usage

  1. Edit the config.json file to configure the DoH URL and any custom domain resolution rules:
{
  "dohurl": "https://8.8.8.8/resolve",
  "rules": {
    "example.com": "0.0.0.0",
    "*.including-subdomain.com": "0.0.0.0"
  }
}
  1. Run the SimpleDNS server:
./SimpleDNS
  1. To test the server, you can use the dig command:
dig @localhost example.com

Configuration

The configuration file is in JSON format and has two main properties:

  • dohurl: The URL of the DoH service to use for domain name resolution (e.g., "https://dns.google.com/resolve").
  • rules: A dictionary of domain names and their corresponding IPv4 addresses. You can specify wildcard subdomains using the "*.domain.com" syntax.

License

This project is licensed under the MIT License.