Open Dig is a DNS resolution/query tool based on the bind dig utility, providing a simple Web UI and RESTful API. It performs EDNS queries from multiple regions to analyze how a website is resolved in different geographies.
The project was inspired by a friend who recommended the site https://mdig.cc/, saying it can conveniently query global DNS resolution via EDNS, and suggested an open-source version. I thought it sounded fun and useful as a theory validation, so I implemented one (Cursor also contributed to this project). However, I don't have an IP-to-region database, so I cannot determine which region a resolved IP belongs to; some features cannot be implemented in the open-source version.
Project GitHub: https://github.com/JimmyKmi/open-dig
Features
- 🌐 Friendly Web UI for DNS queries
- 🔧 Supports multiple DNS record types (A, AAAA, CNAME, MX, NS, TXT, SOA, PTR, SRV, etc.)
- 🎯 Ability to specify custom DNS servers
- 📊 Detailed query result display
- 🚀 RESTful API
- ⚙️ Flexible configuration for the dig executable path
Deployment
#Direct deployment
- Environment requirements
- Node.js 18+
- The dig tool (bind9) installed on the system (installation reference: https://lzj.ac.cn/notes/sre/bind-dM2dd8vF9K)
- Follow the "Development Guide" to build the project (
npm run build
), then copy the build files to the server (or compile on the server), and run (npm start
).
Docker deployment
Docker-related content is under development.
Docker Compose deployment
Docker-related content is under development.
API Endpoints
#POST /api/dig
Execute a DNS query
Request body:
Response (success):
Response (failure):
**GET /api/status**
Get system status and dig tool information
Response:
Project Structure
Development Guide
#Tech stack
NextJs App (TypeScript + SCSS)
#Development workflow
- Clone the repository.
- Install dependencies: npm install
- Configure environment variables: copy .env.example to .env.local and configure. See environment-related documentation for details.
- Run the project (see scripts below).
Scripts
Troubleshooting
#Common issues
- "Dig tool not available" error
- Check whether the BIND_PATH environment variable is correct
- Verify that the dig executable exists and is executable
- On Windows, ensure the path includes the .exe extension
- "Invalid option: +json" error
- This is expected; the program will automatically fall back to a compatible mode
- Older versions of dig do not support JSON output but will still work
- Permission errors
- Ensure the application has permission to execute the dig tool
- Check file permissions on Linux/macOS
Debugging steps
- Enable debug mode: DEBUG=true
- Check console output
- Visit /api/status to check dig tool status
- Verify environment variable configuration
License
MIT License
#Contributing
Contributions are welcome — please open Issues and Pull Requests!