deno-dns-over-https-server
将需要反向代理的 dns over https 网址设定为环境变量 doh
,
将需要反向代理的最小缓存时间(秒)设定为环境变量 ttl
,
启动
npx -y cross-env "doh=https://dns.alidns.com/dns-query" 'ttl=180' token=token deno run --unstable -A ./main.tsx
访问http://localhost:8000/dns-query
使用 dns over https
也可以设置doh
环境变量为一个json
数组,使用负载均衡
例如设置 doh
为
["https://doh.pub/dns-query","https://security.cloudflare-dns.com/dns-query"]
添加了负载均衡的故障转移功能和校验dns数据包格式的功能
设置doh服务的路径通过环境变量DOH_PATHNAME
为 "/dns-query"
为了 dns 负载均衡,可以对 dns 记录随机排序
dns 记录默认保存在内存中,配置文件为config.ts
,
数据保存方式可以使用mongodb
数据库,
配置环境变量mongodb_url
,mongodb_db
,mongodb_collection
设置域名与地址的映射关系即可,支持多个地址
接口格式为JSONRPC
2.0
访问http://localhost:8000/dns_records
使用 ddns
设置token
环境变量为访问秘钥 token
即可使用 ddns
访问时需要携带token
参数,例如
添加请求头Authorization:Bearer token
openapi 接口在文件deno-dns-over-https-server.openapi.json
中
jsonrpc 接口在文件DNSRecordsInterface.ts
中
可以使用客户端 deno-ddns-over-https-client 进行访问 ddns 服务
jsonrpc
的调用的例子在文件夹dns_records
中