CF-Workers-DoH 是一个基于 Cloudflare Workers 构建的 DNS over HTTPS (DoH) 解析服务。它允许你通过 HTTPS 协议进行 DNS 查询,提高查询的安全性和隐私保护。
Caution
doh.cmliussss.hidns.co 已被GFW阻断,需自行部署使用。
Warning
如需搭建非公益服务,请务必添加TOKEN与URL变量,URL变量推荐为 nginx 即可!
- Workers 部署:复制 _worker.js 代码,
保存并部署即可 - Pages 部署:
Fork后连接GitHub一键部署即可
假设你已部署成功,你的服务域名为:doh.cmliussss.hidns.co
将以下地址添加到支持DoH的设备或软件中:
https://doh.cmliussss.hidns.co/dns-query- 还可使用 Cloudflare 回源端口
2053、2083、2087、2096、8443,例如
https://doh.cmliussss.hidns.co:2053/dns-query- 如您设置了
TOKEN变量为 CMLiussss,则
https://doh.cmliussss.hidns.co/CMLiusssshttps://doh.cmliussss.hidns.co/ip-info- 如您设置了
TOKEN变量为 CMLiussss,则
https://doh.cmliussss.hidns.co/ip-info?token=CMLiusssshttps://doh.cmliussss.hidns.co/ip-info?ip=8.8.8.8- 如您设置了
TOKEN变量为 CMLiussss,则
https://doh.cmliussss.hidns.co/ip-info?ip=8.8.8.8&token=CMLiussss{
"status": "success",
"country": "美国",
"countryCode": "US",
"region": "VA",
"regionName": "弗吉尼亚州",
"city": "Ashburn",
"zip": "20149",
"lat": 39.03,
"lon": -77.5,
"timezone": "America/New_York",
"isp": "Google LLC",
"org": "Google Public DNS",
"as": "AS15169 Google LLC",
"query": "8.8.8.8"
}Note
请将示例中的 doh.cmliussss.hidns.co 替换为你实际部署的域名
| 变量名 | 示例 | 必填 | 备注 |
|---|---|---|---|
| DOH | dns.google |
❌ | 设置上游DoH服务(默认:cloudflare-dns.com) |
| TOKEN | dns-query |
❌ | 设置请求DoH服务路径(默认:/dns-query) |
| URL | https://www.baidu.com/ |
❌ | 主页伪装(设为nginx则伪装为nginx默认页面) |
| URL302 | https://t.me/CMLiussss |
❌ | 主页302跳转(与URL变量同时存在时优先执行URL302) |
Tip
- 使用
dns.google或cloudflare-dns.com作为DoH上游时,解析速度最佳! - 使用
security.cloudflare-dns.com作为DoH上游时,可阻止恶意软件的DNS解析服务; - 使用
family.cloudflare-dns.com作为DoH上游时,可阻止恶意软件和成人内容的DNS解析服务; - 已知
doh.pub自带污染,不适合作为DoH上游; - 目前
sm2.doh.pub、dns.alidns.com和doh.360.cn在非中国大陆环境请求DoH时,会下发干净DNS解析服务,也就是可以作为CF-DoH的上游,但是解析速度不佳。
- 基于 Cloudflare Workers 无服务器架构
- 使用原生 JavaScript 实现
本项目开源使用,欢迎自由部署和修改!
tina-hello、ip-api、Cloudflare、GPT