Screenshot of the DoH Proxy Worker landing page / تصویر صفحه اصلی Worker پروکسی DoH
Note: Add your screenshot to
docs/preview.pngto replace this placeholder
توجه: تصویر خود را درdocs/preview.pngقرار دهید تا این placeholder جایگزین شود
تصویر موجود در مسیر src/img/index.png
A high-performance DNS-over-HTTPS (DoH) proxy worker with multi-provider support, load balancing, and automatic failover
یک worker پروکسی DNS-over-HTTPS با عملکرد بالا، پشتیبانی از چندین ارائهدهنده، توزیع بار و failover خودکار
- Open Chrome / Chrome را باز کنید
- Go to Settings / به Settings بروید
- Tap the three dots (⋮) in the top right corner
- Select Settings
- Navigate to Privacy and Security / به Privacy and Security بروید
- Scroll down and tap Privacy and security
- Tap Security
- Enable Secure DNS / Secure DNS را فعال کنید
- Find "Use secure DNS" option
- Toggle it ON
- Select "With your custom service provider"
- Enter Your DoH Endpoint / Endpoint DoH خود را وارد کنید
- Enter your worker URL:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use the live demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query - Tap Save
- Enter your worker URL:
- Done! / تمام شد!
- Your DNS queries are now encrypted and secure
- Open Chrome / Chrome را باز کنید
- Go to Settings / به Settings بروید
- Click the three dots (⋮) in the top right corner
- Select Settings
- Navigate to Privacy and Security / به Privacy and Security بروید
- Click Privacy and security in the left sidebar
- Click Security
- Enable Secure DNS / Secure DNS را فعال کنید
- Scroll down to "Advanced" section
- Find "Use secure DNS" option
- Toggle it ON
- Select "With your custom service provider"
- Enter Your DoH Endpoint / Endpoint DoH خود را وارد کنید
- Enter your worker URL:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use the live demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query - Click Save
- Enter your worker URL:
- Done! / تمام شد!
- Your DNS queries are now encrypted and secure
For faster access, you can directly navigate to Chrome's security settings:
- Open Chrome / Chrome را باز کنید
- Type in address bar / در نوار آدرس تایپ کنید:
chrome://settings/security - Scroll to "Advanced" section / به بخش "Advanced" اسکرول کنید
- Enable "Use secure DNS" / "Use secure DNS" را فعال کنید
- Select "With your custom service provider" / "With your custom service provider" را انتخاب کنید
- Enter your endpoint:
- Your worker:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Your worker:
- Click Save / Save را کلیک کنید
- Open Firefox / Firefox را باز کنید
- Go to Settings / به Settings بروید
- Click the three lines (☰) in the top right corner
- Select Settings (or Preferences on Mac)
- Navigate to Network Settings / به Network Settings بروید
- Scroll down and click Settings button under "Network Settings"
- Enable DNS over HTTPS / DNS over HTTPS را فعال کنید
- Check "Enable DNS over HTTPS"
- Select "Custom provider" from dropdown
- Enter your endpoint:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Click OK / OK را کلیک کنید
- Open Firefox / Firefox را باز کنید
- Go to Settings / به Settings بروید
- Tap the three dots (⋮) in the bottom right
- Select Settings
- Navigate to Privacy and Security / به Privacy and Security بروید
- Tap Privacy and Security
- Scroll to "DNS over HTTPS"
- Enable and Configure / فعال و پیکربندی کنید
- Toggle "DNS over HTTPS" ON
- Select "Custom"
- Enter your endpoint:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Save / ذخیره کنید
- Open Opera / Opera را باز کنید
- Go to Settings / به Settings بروید
- Click the Opera logo in the top left
- Select Settings (or press
Alt+P)
- Navigate to Advanced / به Advanced بروید
- Click Advanced in the left sidebar
- Click Privacy & security
- Enable Secure DNS / Secure DNS را فعال کنید
- Scroll to "Use DNS-over-HTTPS instead of the system DNS"
- Toggle it ON
- Select "Custom"
- Enter your endpoint:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Save / ذخیره کنید
- Open Opera / Opera را باز کنید
- Go to Settings / به Settings بروید
- Tap the Opera logo (O) in the bottom right
- Tap Settings
- Navigate to Privacy & Security / به Privacy & Security بروید
- Tap Privacy & Security
- Scroll to "DNS-over-HTTPS"
- Enable and Configure / فعال و پیکربندی کنید
- Toggle "Use DNS-over-HTTPS" ON
- Select "Custom provider"
- Enter your endpoint:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Save / ذخیره کنید
- Open Edge / Edge را باز کنید
- Go to Settings / به Settings بروید
- Click the three dots (⋯) in the top right corner
- Select Settings
- Navigate to Privacy, search, and services / به Privacy, search, and services بروید
- Click Privacy, search, and services in the left sidebar
- Scroll to "Security" section
- Enable Secure DNS / Secure DNS را فعال کنید
- Find "Use secure DNS to specify how to lookup the network address for websites"
- Toggle it ON
- Select "Choose a service provider"
- Click "Enter custom provider"
- Enter your endpoint:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or use demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Save / ذخیره کنید
Method 1: Private DNS (Android 9+)
- Open Settings / Settings را باز کنید
- Go to Network & Internet / به Network & Internet بروید
- Tap Network & Internet
- Tap Advanced
- Tap Private DNS
- Configure Private DNS / Private DNS را پیکربندی کنید
- Select "Private DNS provider hostname"
- Enter your worker hostname:
your-worker-name.your-subdomain.workers.dev - Or use demo:
darkcodeit.darkcodeit.workers.dev - Tap Save
- Done! / تمام شد!
Note: Android uses the hostname, not the full URL. The system will automatically use the DoH endpoint.
Method 2: Using a DNS App
- Install a DoH client app from Google Play Store:
- "1.1.1.1" by Cloudflare
- "DNS Over HTTPS" by Quad9
- Or any DoH client app
- Configure the app with your endpoint:
- Your worker:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Your worker:
Using a DNS App:
- Install a DoH client app from App Store:
- "1.1.1.1" by Cloudflare
- "DNS Over HTTPS" by Quad9
- Or any DoH client app
- Configure the app with your endpoint:
- Your worker:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Your worker:
- Enable VPN profile (the app will create a VPN profile for DNS)
Note: iOS doesn't have native DoH support in Settings, so you need to use a third-party app.
Method 1: Using Settings
- Open Settings / Settings را باز کنید
- Press
Windows + I
- Press
- Go to Network & Internet / به Network & Internet بروید
- Click Network & Internet
- Click Wi-Fi or Ethernet
- Click your network connection
- Configure DNS / DNS را پیکربندی کنید
- Scroll to "DNS server assignment"
- Click "Edit"
- Select "Manual"
- Turn ON "IPv4"
- For Preferred DNS, enter:
1.1.1.1(or any DNS server) - For Preferred DNS encryption, select "Encrypted only (DNS over HTTPS)"
- For DNS over HTTPS template, enter your endpoint:
- Your worker:
https://your-worker-name.your-subdomain.workers.dev/dns-query - Or demo:
https://darkcodeit.darkcodeit.workers.dev/dns-query
- Your worker:
- Click Save
Method 2: Using Command Prompt (Advanced)
- Open Command Prompt as Administrator / Command Prompt را به عنوان Administrator باز کنید
- Run the following commands / دستورات زیر را اجرا کنید:
# Set DNS over HTTPS
# Replace with your worker hostname and endpoint
netsh dns add encryption server=your-worker-name.your-subdomain.workers.dev dohtemplate=https://your-worker-name.your-subdomain.workers.dev/dns-query
# Or use the demo endpoint
netsh dns add encryption server=darkcodeit.darkcodeit.workers.dev dohtemplate=https://darkcodeit.darkcodeit.workers.dev/dns-queryUsing a DNS App or Browser:
Windows 10 doesn't have native DoH support in Settings. Use one of these methods:
- Use Chrome/Edge with the browser settings (see Chrome/Edge instructions above)
- Use a DNS app like "1.1.1.1" by Cloudflare
- Use PowerShell (requires Windows 11 build or Windows Server 2022)
Method 1: Using System Settings (macOS Ventura+)
- Open System Settings / System Settings را باز کنید
- Go to Network / به Network بروید
- Click Network
- Select your network connection (Wi-Fi or Ethernet)
- Click Details
- Configure DNS / DNS را پیکربندی کنید
- Click DNS
- Click "+" to add a DNS server
- Enter:
1.1.1.1(or any DNS server) - For DoH, you'll need to use a third-party app or browser settings
Method 2: Using Terminal (Advanced)
- Open Terminal / Terminal را باز کنید
- Install a DoH client like
cloudflared:
brew install cloudflare/cloudflare/cloudflared- Configure cloudflared to use your DoH endpoint
Method 1: Using systemd-resolved (Ubuntu 20.04+)
- Open Terminal / Terminal را باز کنید
- Edit resolved.conf:
sudo nano /etc/systemd/resolved.conf- Add the following lines:
[Resolve]
DNS=1.1.1.1
DNSOverTLS=yes
DNSOverHTTPS=yes
# Replace with your worker endpoint
DoHServer=https://your-worker-name.your-subdomain.workers.dev/dns-query
# Or use the demo endpoint
# DoHServer=https://darkcodeit.darkcodeit.workers.dev/dns-query- Restart systemd-resolved:
sudo systemctl restart systemd-resolvedMethod 2: Using a DNS App
- Install a DoH client:
# For Ubuntu/Debian
sudo apt install cloudflared
# For Fedora
sudo dnf install cloudflared
# For Arch Linux
sudo pacman -S cloudflared- Configure cloudflared to use your DoH endpoint
- Visit: https://1.1.1.1/help
- Check "Using DNS over HTTPS (DoH)" - should show "Yes"
- Check "Using DNS over TLS (DoT)" - may show "No" (that's okay)
- Your DNS provider should show your custom endpoint
- Visit: https://www.dnsleaktest.com
- Run a standard test
- Check the results - you should see DNS queries going through your endpoint
- 🚀 High Performance: Leverages Cloudflare's global edge network for minimal latency
- 🔄 Multi-Provider Support: Distributes requests across 8 different DNS providers
- ⚖️ Weighted Load Balancing: Intelligent request distribution based on configurable weights
- 🛡️ Automatic Failover: Seamlessly switches to backup providers when primary ones fail
- 🎯 Ad-Blocking Support: Includes ad-blocking DNS providers (AdGuard, ControlD, Mullvad, NextDNS)
- 🌐 CORS Support: Full CORS support for web clients
- 💾 Caching: DNS responses cached for improved performance
- 🎨 Modern UI: Beautiful terminal-style interface with dark theme
- 📱 Responsive Design: Works perfectly on all devices
- 🚀 عملکرد بالا: استفاده از شبکه edge جهانی Cloudflare برای حداقل تأخیر
- 🔄 پشتیبانی از چندین ارائهدهنده: توزیع درخواستها بین 8 ارائهدهنده DNS مختلف
- ⚖️ توزیع بار با وزن: توزیع هوشمند درخواستها بر اساس وزنهای قابل تنظیم
- 🛡️ Failover خودکار: سوئیچ خودکار به ارائهدهندگان پشتیبان در صورت مشکل
- 🎯 پشتیبانی از مسدودسازی تبلیغات: شامل ارائهدهندگان DNS مسدودکننده تبلیغات (AdGuard, ControlD, Mullvad, NextDNS)
- 🌐 پشتیبانی از CORS: پشتیبانی کامل از CORS برای کلاینتهای وب
- 💾 Caching: cache پاسخهای DNS برای بهبود عملکرد
- 🎨 رابط کاربری مدرن: رابط کاربری زیبا با استایل ترمینال و تم تاریک
- 📱 طراحی واکنشگرا: کارکرد عالی در تمام دستگاهها
| Provider | Weight | URL | Features |
|---|---|---|---|
| Cloudflare | 20% | https://cloudflare-dns.com/dns-query |
Fast, Reliable |
| 15% | https://dns.google/dns-query |
Fast, Reliable | |
| Quad9 | 15% | https://dns.quad9.net/dns-query |
Security-focused |
| OpenDNS | 10% | https://doh.opendns.com/dns-query |
Reliable |
| AdGuard | 10% | https://dns.adguard.com/dns-query |
Ad-blocking |
| ControlD | 10% | https://freedns.controld.com/p2 |
Ad-blocking |
| Mullvad | 10% | https://adblock.dns.mullvad.net/dns-query |
Ad-blocking |
| NextDNS | 10% | https://dns.nextdns.io/dns-query |
Ad-blocking |
- Node.js 18+ installed
- Cloudflare account
- Wrangler CLI installed globally (optional)
- Clone the repository / کلون کردن مخزن:
git clone https://github.com/Darkcode-it/multi-provider-doh-proxy.git
cd multi-provider-doh-proxy- Install dependencies / نصب وابستگیها:
npm install- Configure the worker / پیکربندی worker:
Edit wrangler.toml to configure your worker:
name = "doh-proxy-worker"
compatibility_date = "2024-01-01"
main = "src/index.js"
[vars]
CACHE_TTL = 300
PROVIDERS = [
'{"name": "cloudflare", "url": "https://cloudflare-dns.com/dns-query", "weight": 20}',
'{"name": "google", "url": "https://dns.google/dns-query", "weight": 15}',
# ... more providers
]- Deploy to Cloudflare / Deploy در Cloudflare:
npm run deployRun the worker locally:
npm run devThe worker will be available at http://localhost:8787
.
├── src/
│ └── index.js # Main worker code
├── wrangler.toml # Cloudflare Worker configuration
├── package.json # Node.js dependencies
└── README.md # This file
Your DoH endpoint will be available at:
https://your-worker-name.your-subdomain.workers.dev/dns-query
For GET requests, the DNS query must be base64url-encoded:
curl "https://your-worker.workers.dev/dns-query?dns=q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB"For POST requests, send the DNS query as binary data:
curl -X POST \
-H "Content-Type: application/dns-message" \
--data-binary @query.dns \
https://your-worker.workers.dev/dns-querydig @your-worker.workers.dev example.comYou can use this endpoint in any DoH-compatible client:
- Firefox: Settings → Network Settings → Enable DNS over HTTPS → Custom → Enter your endpoint URL
- Chrome/Edge: Settings → Privacy and security → Security → Use secure DNS → Custom → Enter your endpoint URL
- Opera: Settings → Advanced → Privacy & security → Use DNS-over-HTTPS → Custom → Enter your endpoint URL
The worker uses environment variables defined in wrangler.toml:
- CACHE_TTL: Cache time-to-live in seconds (default: 300)
- PROVIDERS: Array of JSON strings containing provider configuration
Each provider is configured with:
- name: Provider name (e.g., "cloudflare")
- url: DoH endpoint URL
- weight: Weight for load balancing (higher = more requests)
Example:
{
"name": "cloudflare",
"url": "https://cloudflare-dns.com/dns-query",
"weight": 20
}You can add custom DNS providers by modifying the PROVIDERS array in wrangler.toml:
PROVIDERS = [
'{"name": "custom-provider", "url": "https://custom-dns.com/dns-query", "weight": 10}',
# ... existing providers
]The worker uses weighted random selection to distribute requests across providers. Providers with higher weights receive more requests.
If a primary provider fails, the worker automatically tries other providers in the list until one succeeds.
DNS responses are cached for the duration specified in CACHE_TTL to improve performance and reduce upstream requests.
All responses include CORS headers, allowing the endpoint to be used from web browsers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Accept
- Latency: < 50ms average (thanks to Cloudflare's edge network)
- Uptime: 99.9%+ (with automatic failover)
- Throughput: Handles thousands of requests per second
- Cache Hit Rate: ~70% (for common queries)
Query DNS using GET request with base64url-encoded query parameter.
Parameters:
dns(required): Base64url-encoded DNS message
Example:
GET /dns-query?dns=q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQABQuery DNS using POST request with binary DNS message in body.
Headers:
Content-Type: application/dns-messageAccept: application/dns-message
Body:
- Binary DNS message
Example:
POST /dns-query
Content-Type: application/dns-message
<binary-dns-message>Landing page with information about the worker and usage examples.
Detailed explanation of DNS query encoding in DoH.
Solution: Check that all provider URLs are correct and accessible.
Solution:
- Check your Cloudflare Worker location
- Verify provider URLs are working
- Check cache configuration
Solution: CORS headers are automatically included. If you still see errors, check that you're using the correct endpoint URL.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Darkcode-it
- GitHub: @Darkcode-it
- Telegram: @darkcodeit
- Cloudflare for providing the Workers platform
- All DNS providers for their free DoH services
- The open-source community for inspiration and support
- 🌐 Live Demo: https://darkcodeit.darkcodeit.workers.dev
- 📦 GitHub Repository: https://github.com/Darkcode-it/multi-provider-doh-proxy
- 💬 Telegram: https://t.me/darkcodeit
Made with ❤️ by Darkcode-it
⭐ Star this repo if you find it useful!
