kdns is a local DNS server and traffic inspection tool designed to help you monitor and analyze DNS traffic on your localhost. This tool provides a REST API for querying and modifying DNS configuration information and a real-time web interface for visualizing DNS logs.
Inspecting DNS traffic can be essential for understanding how your applications resolve domain names and identifying any potential issues. kdns aims to simplify the process of modifying DNS records, monitoring DNS queries and responses on your local system.
- External DNS Resolver support
- DNS Record Customization
- REST API for querying and chaning DNS configuration
- Real-time web interface for visualizing DNS logs
- Fast, simple, and easy-to-use
The REST API provided by kdns allows you to retrieve DNS information programmatically. Here are some of the available endpoints:
- GET http://localhost:8080/api/config: Retrieve current kdns configuration.
- POST http://localhost:8080/api/config: Update kdns configuration.
kdns offers a real-time web interface for visualizing DNS logs. To view the web interface, follow these steps:
-
Clone this repository:
git clone https://github.com/karfianto/kdns.git cd kdns
-
Build the package
go build
Or download precompiled binaries in release page.
-
Run the binary
For Windows
kdns.exe
For Linux
./kdns_linux64
For Mac
./kdns_macos
-
Open your host Network Adapter Setting and change your DNS Server to
127.0.0.1
-
Open your web browser and visit
http://localhost:8080
to access the real-time web interface.
Before running kdns, you can configure its behavior using environment variables stored in a .env
file. Here are the available environment variables and their descriptions:
-
HTTP_BIND_URL
: The IP address to bind to. Set it to0.0.0.0
to listen on all available network interfaces. -
HTTP_PORT
: The port number to listen on for incoming HTTP requests. Default is8080
. -
HTTP_MODE
: Set the mode for your application. You can useproduction
for production deployments anddevelopment
for local development and debugging. -
DNS_DEBUG
: Set this totrue
to enable DNS debugging in terminal.
Here's an example of a .env
file that you can customize for your needs:
HTTP_BIND_URL=0.0.0.0
HTTP_PORT=8080
HTTP_MODE=production
DNS_DEBUG=true
Contributions to kdns are welcome and encouraged! Here's how you can contribute:
- Fork the repository to your GitHub account.
- Create a new branch for your feature or bug fix:
git checkout -b feature/my-feature
- Make your changes and commit them with clear commit messages.
- Push your changes to your fork:
git push origin feature/my-feature
- Create a pull request (PR) against the main branch of this repository.