{"id":50748338,"url":"https://github.com/amanyadav-work/dns-server","last_synced_at":"2026-06-10T23:01:37.208Z","repository":{"id":361599269,"uuid":"1234443460","full_name":"amanyadav-work/dns-server","owner":"amanyadav-work","description":"A minimal Go DNS server that listens on UDP port 8282 and responds only to A record (IPv4) queries for a predefined set of domains. Perfect for learning DNS fundamentals, Go networking, or experimenting with custom DNS logic in a clear, easy-to-understand project.","archived":false,"fork":false,"pushed_at":"2026-05-31T11:26:29.000Z","size":6794,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-31T13:13:06.058Z","etag":null,"topics":["dns","dns-server","dnsquery","golang","minimal-server-setup","udp-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amanyadav-work.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-10T07:34:48.000Z","updated_at":"2026-05-31T11:26:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/amanyadav-work/dns-server","commit_stats":null,"previous_names":["amanyadav-work/dns-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/amanyadav-work/dns-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanyadav-work%2Fdns-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanyadav-work%2Fdns-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanyadav-work%2Fdns-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanyadav-work%2Fdns-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amanyadav-work","download_url":"https://codeload.github.com/amanyadav-work/dns-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanyadav-work%2Fdns-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34174148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","dns-server","dnsquery","golang","minimal-server-setup","udp-server"],"created_at":"2026-06-10T23:01:36.677Z","updated_at":"2026-06-10T23:01:37.199Z","avatar_url":"https://github.com/amanyadav-work.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# DNS GO — Code Overview\n\nThis project is a minimal DNS server written in Go, designed to answer only A record (IPv4 address) queries for a small set of domains. It is intentionally simple, making it easy to understand the DNS protocol and Go networking basics.\n\n## How It Works\n\n**Supported Record Types:**\n- Only DNS A records (IPv4) are supported. All other record types (e.g., AAAA, MX) will return no answer.\n\n**Supported Domains:**\n- The list of domains and their IPv4 addresses is defined in `names.json`. Example:\n  - google.com → 3.1.3.7\n  - acint.net → 192.168.0.102\n  - yadavaman.duckdns.org → 100.125.140.68\n\n**Port:**\n- The server listens on UDP port **8282**.\n\n## File Roles\n\n- `main.go`: Entry point. Sets up the UDP server, handles incoming DNS requests, parses queries, and sends responses.\n- `dblookup.go`: Loads the domain-to-IP mapping from `names.json` and provides lookup logic.\n- `models/dns.go`: Contains Go structs for DNS headers, resource records, and domain models.\n- `names.json`: The configuration file listing supported domains and their IPv4 addresses.\n\n## Request/Response Flow\n\n1. **DNS Query Sent:**\n  - A client (e.g., using `dig`) sends a DNS query for an A record to UDP port 8282.\n\n2. **Server Receives Query:**\n  - `main.go` reads the UDP packet, parses the DNS header and question section.\n\n3. **Domain Lookup:**\n  - The server checks if the query is for an A record (`TypeA`) and if the domain exists in `names.json`.\n  - If both match, it prepares a DNS response with the mapped IPv4 address.\n  - If not, it returns an empty answer section.\n\n4. **Response Sent:**\n  - The server serializes the DNS response and sends it back to the client over UDP.\n\n## Example Query and Flow\n\nSuppose you run:\n\n```sh\ndig @127.0.0.1 -p 8282 google.com A\n```\n\n**What happens:**\n- The server receives the query for `google.com` A record on port 8282.\n- It finds `google.com` in `names.json` and responds with 3.1.3.7.\n- The dig output will show this IP in the ANSWER section.\n\nIf you query for an unsupported record type or unknown domain, the ANSWER section will be empty.\n\n## Summary\n\n- Only A records for domains in `names.json` are answered.\n- The server is intentionally simple and easy to read.\n- Great for learning about DNS and Go networking.\n\n---\nMIT License. Free to use, modify, and share.\n\n## Project Structure\n- `main.go` — Entry point, starts the DNS server\n- `dblookup.go` — Handles DNS record lookups\n- `models/` — Data models (e.g., DNS record structs)\n- `names.json` — Example DNS records or configuration\n- `tmp/` — Temporary files or runtime data\n\n## Why Use This Project?\n- **Simplicity:** The codebase is small and easy to understand.\n- **Learning:** Great for learning about DNS and Go networking.\n- **Customization:** Easily add your own DNS logic or records.\n\n## License\nMIT License. Free to use, modify, and share.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanyadav-work%2Fdns-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famanyadav-work%2Fdns-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanyadav-work%2Fdns-server/lists"}