https://irine-sistiana.gitbook.io/mosdns-wiki参考配置
使用内置执行器cache
[root@localhost ~]# cat /etc/mosdns/config.yaml
log:
level: debug
file: /tmp/mosdns.log
plugins:
- tag: main
type: sequence
args:
- exec: cache 10000 #查找 cache。
- matches: # 如果
- has_resp # 有应答了(上一步 cache 找到应答)
exec: accept # 结束。
# 上一步没有找到缓存,就会到这一步,转发至阿里云获取应答。
- exec: forward https://dns.alidns.com/dns-query?
# sequence 结束(被 reject,accept,或者运行到末尾)后就会返回调用者。在这个配置文件中
# 调用者是下面的服务器。服务器就会返回应答至客户端。
# 启动 udp 和 tcp 服务器。
- type: udp_server
args:
entry: main # 收到的请求会执行上面的逻辑
listen: 0.0.0.0:53
- type: tcp_server
args:
entry: main
listen: 0.0.0.0:53
使用自定义lazy_cache插件
[root@localhost 100trust]# cat /etc/mosdns/config.yaml
log:
level: debug
file: /tmp/mosdns.log
plugins:
- tag: lazy_cache
type: cache
args:
size: 10240
lazy_cache_ttl: 86400
dump_file: /tmp/mosdns.dump
- tag: main
type: sequence
args:
- exec: $lazy_cache
- matches: has_resp
exec: accept
# 上一步没有找到缓存,就会到这一步,转发至360获取应答。
- exec: forward https://doh.360.cn/dns-query
# sequence 结束(被 reject,accept,或者运行到末尾)后就会返回调用者。在这个配置文件中
# 调用者是下面的服务器。服务器就会返回应答至客户端。
# 启动 udp 和 tcp 服务器。
- type: udp_server
args:
entry: main # 收到的请求会执行上面的逻辑
listen: 0.0.0.0:53
- type: tcp_server
args:
entry: main
listen: 0.0.0.0:53
[root@localhost 100trust]# cat /etc/mosdns/config.yaml
log:
level: debug
file: /tmp/mosdns.log
plugins:
- tag: lazy_cache
type: cache
args:
size: 10240
lazy_cache_ttl: 86400
dump_file: /tmp/mosdns.dump
- tag: "remote_forward"
type: forward
args:
concurrent: 2
upstreams:
- addr: "https://doh.360.cn/dns-query"
idle_timeout: 86400
- addr: "https://dns.alidns.com/dns-query?"
idle_timeout: 86400
- tag: main
type: sequence
args:
- exec: $lazy_cache
- matches: has_resp
exec: accept
# 上一步没有找到缓存,就会到这一步,转发至remote_forward获取应答。
- exec: $remote_forward
# sequence 结束(被 reject,accept,或者运行到末尾)后就会返回调用者。在这个配置文件中
# 调用者是下面的服务器。服务器就会返回应答至客户端。
# 启动 udp 和 tcp 服务器。
- type: udp_server
args:
entry: main # 收到的请求会执行上面的逻辑
listen: 0.0.0.0:53
- type: tcp_server
args:
entry: main
listen: 0.0.0.0:53
[root@localhost 100trust]#