A DNS proxy that forwards local UDP DNS queries to a DNSCrypt v2 resolver.
This tool acts as a local DNS proxy, receiving standard DNS queries on UDP port 53 and forwarding them securely to a DNSCrypt v2 resolver.
Running the Application:
By default, dns2tcp
uses a pre-configured public DNSCrypt resolver (AdGuard DNS):
# Requires privileges to bind to port 53, often sudo is needed.
sudo ./dns2tcp
Using a Custom DNSCrypt Resolver:
You can specify a different DNSCrypt v2 resolver using its DNS Stamp string via the -stamp
command-line flag:
sudo ./dns2tcp -stamp "sdns://YOUR_DNSCRYPT_STAMP_HERE"
Public DNSCrypt resolver stamps can be found on sites like https://dnscrypt.info/stamps and other curated lists.
Testing:
Once dns2tcp
is running, you can point a DNS client like dig
or nslookup
to 127.0.0.1
to test it:
dig @127.0.0.1 yourdomain.com
This project is written in Go.
- Go (version 1.16 or later recommended).
- Clone the repository (if you haven't already).
- Navigate to the project directory.
- To build the executable:
This will create an executable named
go build dns2tcp.go
dns2tcp
(ordns2tcp.exe
on Windows) in the current directory.
Unit tests are provided to verify functionality, especially the DNS message parsing.
- Ensure Go modules are initialized (this should have been done if tests were run previously):
go mod init dns2tcp # (Or your chosen module name if different)
- To run the tests:
go test -v